Since you want to show items in the visible area using for example the click event of a button you can get the visible area using the RadMap.LocationRect property. But as I see from your code you use the Dynamic Layer to show your items on the map. The UpperLeft and LowerRight parameters of event arguments depend on the ZoomGridList you use in your application for the dynamic layer.
The optimal value for number of the Latitudes and Longitudes in ZoomGridList depends on the viewport (visible area) size of the map control and the min zoom level of the zoom grid.
I think that the dynamic layer will have best performance when the square size for request will be approximately equal to the viewport size.
The count could be calculated the following way:
1. For example the viewport size is 1024x1024.
2. The map size is 512x512 when the zoom level is 1, 1024x1024 for 2 and 2048x2048 for 3 etc. The map size is calculated as 2 ^ (zoom level + 8).
3. When the zoom level is 3, then the count could be calculated as 2048 / 1024 = 2. I.e. count is calculated as map size/ viewport size.
I would recommend using the way of ZoomGridList calculation above for achieving good performance for high zoom levels. The sample code is below.
latitudes = (
)(Math.Pow(2, minZoomLlevel + 8) / viewportHeight);
latitudes = Math.Max(latitudes, 1);
longitudes = (
)(Math.Pow(2, minZoomLlevel + 8) / viewportWidth);
longitudes = Math.Max(longitudes, 1);
ZoomGrid(latitudes, longitudes, minZoomLlevel));
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>