Zoom Map Initially

Hello SyncfusionTeam,

I'm using the Map and I need to implement the Initial Zoom on the map.

I tried to accomplish this by using the following LoadMehtod:
I dont get the output of the console.log() and
 get the following Error on loading the Page

Regards,
M. Bremer

3 Replies 1 reply marked as answer

SB Swetha Babu Syncfusion Team April 30, 2021 11:26 AM UTC

Hi Mike, 
 
Thank you for contacting Syncfusion support. 
 
We are able to reproduce the reported issue. When we checked the provided code snippet, we came to know that you are refreshing the maps in the “load“ event. When we refresh the Maps, the load event will be triggered. Since you are calling the refresh() method in load event, the execution gets looped and results in the reported issue. To resolve this issue, we need to set the local variable “isRefreshed” as true before calling the refresh() method of Maps. This will resolve the reported issue. 
If you want to zoom the map layer initially without markers, you can set the “Latitude” and “Longitude” properties in the “CenterPosition” property of the Maps control and set the desired zoom value in the “ZoomFactor” property of “ZoomSettings” property in Maps. If you want to zoom the maps initially based on the markers rendered in the Maps, you can set the “ShouldZoomInitially” property as true in “ZoomSettings” property of Maps. However, we have created the ASP.NET MVC application to demonstrate the same and it can be downloaded from  the below link. 
  
  
In the above sample, we have rendered the OSM map with the markers and ShouldZoomInitially property as true in the load event of Maps. Please let us know if the above sample meets your requirement. If not, please let us know your exact requirement. It will be helpful for us to analyze further and assist you better. 
 
Regards, 
Swetha Babu 
  


Marked as answer

MB Mike Bremer May 6, 2021 08:14 AM UTC

Thank you,
it's working perfect


SA Sabari Anand Senthamarai Kannan Syncfusion Team May 7, 2021 05:00 AM UTC

 Hi Mike, 
 
We are happy to hear that the provided solution resolves the reported issue. Please let us know if you need any further assistance. 
 
Regards, 
Sabari Anand 


Loader.
Up arrow icon