I have implemented ItemsRequest, and it returns the MapPinPoints from an Observable collection. However, if I alter the Observable collection, then how can I make the DynamicLayer call the ItemsRequest again to see if any of the new points are now visible?
6 Answers, 1 is accepted

1. In the ItemsRequestEventArgs you get the UpperLeft and LowerRight locations. What do these actually signify. They aren't the locations of the corners of the visible map, as the ItemsRequest seems to be only called when we move over a ZoomGrid boundary. I seem to always get a LocationRect of a large area even when zoomed in, so I end up having to give more items then I want to.
2. The second question is how does the ZoomGridList work, and how does it have an effect on point 1.
DynamicLayer dynamicLayer =
new
DynamicLayer();
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(2, 2, 3));
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(4, 4, 9));
radMap.Items.Add(dynamicLayer);
I know you give the latitudes, the longitudes and the zoom, but how do they work? My gut reaction is that you are defining squares that will ask for items as they come into view, and these squares are associated with the zoom layer. If this is the case, then I would expect the ItemsRequest method to be called as the map is panned?
Hope you can straighten me out on how the dynamic layer actually works so that I can optimise my display
Thanks
Simon
The DynamicLayer contains Refresh method. It clears items from the layer and re-requests them for regions in current location and zoom.
You can call it when the collection has been changed.
The DynamicLayer requires a division of the map space in regions. Each ZoomGrid defines a minimum zoom level for its division. The maximum zoom level for a grid is the minimum zoom layer of the next grid in the list. Also each zoom level is divided in a grid of latitude/longitude divisions.
DynamicLayer dynamicLayer =
new
DynamicLayer();
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(2, 2, 3));
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(4, 4, 9));
radMap.Items.Add(dynamicLayer);
There are two grid lists - one goes from zoom 3 to 9, and the other - from zoom 9 to the maximum zoom. Also, the first grid has a 2 by 2 latitude/longitude division. This means that map is divided in 4 regions, and the second slice is divided into 16 regions - higher zoom values require more divisions to perform well.
The Dynamic layer requests data for the current visible regions only. It requests data when the map is panned to a region which has not been requested earlier. The Dynamic layer removes items from invisible squares, but it caches them and it adds them from a cache as soon as the square gets to the visible area.
The Dynamic layer clears its items when the zoom level is changed from one zoom range to another. For example when you change it from 8 to 9 then the layer clears its items and performs requests for each visible square.
All the best,
Andrey Murzov
the Telerik team


What is the maximum number of rectangles that I should split the grid into? For example at the most detail we are down to showing about a 100m x 100m square on the screen. If you are to divide this by say 10,000km you end up with many many squares. I tried this, and the machine froze and then exited me from my application
Optimal value for the Latitudes and Longitudes count depends on the viewport 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 in 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 = 4. I.e. count is calculated as map size/ viewport size.
So, the grid list for zoom levels 3 and 9 could be specified like this:
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(2, 2, 3));
dynamicLayer.ZoomGridList.Add(
new
ZoomGrid(128, 128, 9));
Kind regards,
Andrey Murzov
the Telerik team
