We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

centre map

Thread ID:

Created:

Updated:

Platform:

Replies:

140719 Nov 3,2018 03:09 PM UTC Nov 7,2018 08:45 AM UTC Xamarin.Forms 3
loading
Tags: SfMaps
john murray
Asked On November 3, 2018 03:09 PM UTC

I have begun experimenting with sfMap
I simply want to use OSM worldmap but zoomed to a particular location.
I can work out the zoom level required but I cant figure out how to (programmatically) pan to the required location.

I note a previous post over a year and a half ago said there was no functionality to centre a map
Is there now any way to achieve what I am trying to do ?

tia
JM

Sheik Syed Abthaheer M [Syncfusion]
Replied On November 5, 2018 10:41 AM UTC

Hi John, 
Thanks for contacting Syncfusion Support. 
We can achieve your requirement of zooming the location by specifying the desired latitude and longitude in the GeoCoordinates property of imagery layer as like the below code snippet, 
         <maps:SfMaps ZoomLevel="3"> 
            <maps:SfMaps.Layers> 
                <maps:ImageryLayer x:Name="layer" GeoCoordinates="51.509, "-0.1180"> 
                    <maps:ImageryLayer.Markers> 
                        <maps:MapMarker  Label="London"  
                                         Latitude="51.509"  
                                         Longitude= "-0.1180"/> 
                        </maps:ImageryLayer.Markers> 
                </maps:ImageryLayer> 
            </maps:SfMaps.Layers> 
        </maps:SfMaps> 
 

Please find the output screen shot 
 
  
  
Please find the demo sample from below location 
Sample: MapsPanning 
Regards, 
Devi 



john murray
Replied On November 5, 2018 12:31 PM UTC

many thanks 
I know you've all pretty much moved exclusively to xaml but it would help to see the c# equivalent

Michael Prabhu M [Syncfusion]
Replied On November 7, 2018 08:45 AM UTC

Hi John, 
  
Based on your query, we have prepared the sample in code behind. Please download the sample from the below link, 
  
Code Snippet: 
  
C#: 
  
            SfMaps maps = new SfMaps(); 
            maps.ZoomLevel = 3; 
  
            ImageryLayer imageryLayer = new ImageryLayer(); 
            imageryLayer.GeoCoordinates = new Point(51.509, -0.1180); 
  
            MapMarker marker = new MapMarker(); 
            marker.Label = "London"; 
            marker.Latitude = "51.509"; 
            marker.Longitude = "-0.1180"; 
  
            imageryLayer.Markers.Add(marker); 
           
            maps.Layers.Add(imageryLayer); 
  
Sample: 
  
Regards, 
Michael 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;