This is a migrated thread and some comments may be shown as answers.

Map not centering

3 Answers 43 Views
Map
This is a migrated thread and some comments may be shown as answers.
krisdoff
Top achievements
Rank 1
krisdoff asked on 27 Feb 2012, 02:26 PM
Hi there,
Hopefully a simple question.

I am getting the results of a geocode query back successfully, i.e. it appears to have a valid Long+Lat, but I cant seem to center the map on that location (and preferably zoom).  Do I need to do more than this?:

      private void geoProvider_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
        {

            if (e.Response.Results != null && e.Response.Results.Count > 0)
            {

                 Telerik.Windows.Controls.Map.Location location = e.Response.Results[0].Locations[0];
                 radMap1.Center = location;

            }

        }


Many Thanks


3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 01 Mar 2012, 10:36 AM
Hi Chris,

The code is OK.
This behavior could occur when you restrict a panning region in RadMap specifying the GeoBounds property. And when a geocode result has the location which is out of this area.
It is very complicated and it is hard to reproduce the problem without your solution, but using just a code snippet you sent. Could you, please, provide us with your solution or with a small sample solution which reproduces it?

Greetings,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
krisdoff
Top achievements
Rank 1
answered on 01 Mar 2012, 06:57 PM
Hi there,

Actually turned out to be the way I was declaring the control in XAML.  Not sure where I got the code from but it was this :

<UserControl x:Class="Aurum.ShowAddress"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
              xmlns:aurum="clr-namespace:Aurum"

    mc:Ignorable="d"
    d:DesignHeight="500" d:DesignWidth="800" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
   
 
        <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <aurum:AurumDialogue x:Name="frmPopup" PanelHeight="460" PanelWidth="620" TitleText="Choose order status" >
                <aurum:AurumDialogue.Content>
                    <Grid Width="Auto" Height="Auto">
                    <telerik:RadMap Height="400" Width="600" HorizontalAlignment="Left"  Name="radMap1" VerticalAlignment="Top"  >
            <m:Map x:Name="myMap" CredentialsProvider="OURKEY" Mode="Road"/>
                            </telerik:RadMap>
                    </Grid>
                       
                </aurum:AurumDialogue.Content>
            </aurum:AurumDialogue>
         
    </Grid>
</UserControl>



Thanks for your help though
0
Andrey
Telerik team
answered on 06 Mar 2012, 11:42 AM
Hello Chris,

Your XAML definitely looks strange. The only child elements allowed for RadMap control are map layers (i.e. InformationLayer, DynamicLayer, VirtualizationLayer).

Kind regards,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Map
Asked by
krisdoff
Top achievements
Rank 1
Answers by
Andrey
Telerik team
krisdoff
Top achievements
Rank 1
Share this question
or