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

Programmatically zooming on the map/marker

Thread ID:

Created:

Updated:

Platform:

Replies:

140844 Nov 10,2018 12:02 PM UTC Dec 5,2018 10:26 AM UTC Xamarin.Forms 4
loading
Tags: SfMaps
Rjuken Developments
Asked On November 10, 2018 12:02 PM UTC

Hello SyncfusionTeam,

I'm using the sfMap and I need to implement something that will allow a zoom on the map.

US : When a user loads the map, if he clicks on a given marker, the zoom should adapt to show only the needed part of the map.

For example : having a country map, when user select a region, the zoom should be only on the region.

I tried to do some tricks with properties MaxZoom and MinZoom but nothing's working as expected.

Is there a way to access zoom property without user interaction ?

Thanks. 


Yogapriya Shanmugam [Syncfusion]
Replied On November 12, 2018 08:43 AM UTC

Hi Rjuken, 
 
Query: Programmatically zoom on map marker. 
 
By selecting the map marker, you can programmatically zoom the area around it and this can be achieved by changing the GeoCoordinates and ZoomLevel property in the MarkerSelected event. 
 
By Specifying the marker latitude and longitude values to the GeoCoordinates property, maps will be centered at the specified location. 
To zoom the map, you can increase the ZoomLevel property.  
 
Please find the code snippet below, 
 
private void ImageryLayer_MarkerSelected(object sender, Syncfusion.SfMaps.XForms.MarkerSelectedEventArgs e) 
        {             
            double latitude = Convert.ToDouble(e.MapMarker.Latitude); 
            double longitude = Convert.ToDouble(e.MapMarker.Longitude); 
 
            layer.GeoCoordinates = new Point(latitude, longitude); 
            sfmap.ZoomLevel = 4; 
        } 
 
We have also prepared a sample for the same. You can download the sample from the below link. 
 
  
Please find the screenshot below, 
 
Before Zooming 
 
 
 
 
After Zooming (area around the marker is zoomed) 
 
 
 
Regards, 
Yogapriya.S 


Rjuken Developments
Replied On December 3, 2018 11:17 PM UTC

Hello SyncfusionTeam,

Thank you for this complete answer ! I forgot to tell you that I'm using ShapeFileLayer and not ImageryLayer. 

Is it achievable on a shapeLayer too with another method ? I know ShapeFileLayer does not contain such property as Geocoordinates but ZoomLevel property is accessible, so there might be a way can't figure out.

Regards

Michael Prabhu M [Syncfusion]
Replied On December 4, 2018 11:31 AM UTC

Hi Rjuken, 
 
We have analyzed your query and we like to let you know that currently, we do have programmatic zooming support with specified coordinate at the center for shape file layer as in Imagery layer. We have considered this as a feature request and logged it in to our feature management system. 
 
While this feature itself is important we cannot provide you an exact timeline on when this feature will be available in our suite, this feature will be available in any of our upcoming volume releases. 

Thanks, 
Michael  


Rjuken Developments
Replied On December 5, 2018 10:26 AM UTC

Hello SyncfusionTeam,

Thank you for your fast answer. Yes its a really important feature for us, hope will be available in the next releases. 

Regards.

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

or the page will be automatically redirected to 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

;