Get lat/lon bounds of visible portion of map on SfMap Control

Greetings!

Is there a way to get the visible lat/lon bounds of the SfMap Control? I have a lot of markers to display and would like to draw them only on the visible portion of the map to improve performance.

Thank you in advance!
Jacob

3 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team April 29, 2021 08:50 AM UTC

Hi Jakub,

Greetings from Syncfusion.


Query: Is there a way to get the visible lat/lon bounds of the SfMap Control?
Yes,  you can get the visible area bounds of SfMaps by CenterChanged events arguments as per in the below code snippet
[XAML]:
 
        <syncfusion:SfMap> 
            <syncfusion:SfMap.Layers> 
                <syncfusion:ImageryLayer LayerType="OSM"  CenterChanged="ImageryLayer_CenterChanged" > 
                </syncfusion:ImageryLayer> 
            </syncfusion:SfMap.Layers> 
        </syncfusion:SfMap> 

[C#]:
 
        private void ImageryLayer_CenterChanged(object sender, CenterChangedEventArgs e) 
        { 
            var topLeft = e.TopLeft; 
            var topRight = e.TopRight; 
            var bottomLeft = e.BottomLeft; 
            var bottomRight = e.BottomRight; 
        } 

I have a lot of markers to display and would like to draw them only on the visible portion of the map to improve performance.
By default, we have marker virtualization support and markers in the visible area only will draw in the screen.

Let us know if you need any further assistance.

Regards,
Sridevi S.
 
 


Marked as answer

JA Jakub April 29, 2021 02:57 PM UTC

That's perfect, does exactly what I wanted. And even though you already have marker virtualization by default, all of my markers were still being processed in my code for the entire map so keeping the processing to only what's visible has improved the performance tremendously.

Thank you again Sridevi and Syncfusion :-)

Jacob


SS Sridevi Sivakumar Syncfusion Team April 30, 2021 10:32 AM UTC

Hi Jakub,

We are glad to hear, please let us know if you need any further assistance. As always, we will be happy to assist you.

Regards,
Sridevi S. 


Loader.
Up arrow icon