This is a migrated thread and some comments may be shown as answers.

DynamicSource Bounding Box

12 Answers 130 Views
Map
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 11 Apr 2011, 05:17 PM
I am building an app that displays MapPinPoints indicating locations of items. The total number of items, based on selection criteria, will vary from 100 to 140,000. The higher the altitude, the more items will display. In looking into the DynamicLayer and DynamicSource, it seemed to me that the map engine was going to determine the bounding box based on the zoom level and center point. This appeared to be true when I was working with a small set of items. However, as I began to work with a list of 5,000 items, I was dismayed at the time it was taking to load the items at a zoom level ot 18, which would display about 30 of the items. Setting a breakpoint in the ItemsRequest method, I discovered that the bounding box was huge. I then thought that perhaps I needed to define a zoom grid for each zoom level to restrict the bounding box to a more reasonable size. So I did just that. The results were the same. Is there something I am missing here that would restrict the size of the bounding box?

12 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 11 Apr 2011, 08:55 PM
Another thing I noticed: at every change in zoom level, a request is made that will retrieve ALL of the items.
0
Andrey
Telerik team
answered on 14 Apr 2011, 07:14 AM
Hello Ed,

Mostly, the performance of the dynamic layer depends on its ZoomGridList you use in your application. The 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 (of course if you want to reduce a number of requests to the service, then you can use more large square size).
The count could be calculated using 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.

The dynamic layer adds/removes items dynamically. It works with squares which are calculated according to its ZoomGridList. When a square appears within the visible area of map then the dynamic layer adds its items onto the view. When a square gets out from visible area then the dynamic layer removes its items. During the panning a few squares can change its visibility. When squares contain a lot of points (1000 or more) then this process takes a long time.

I have attached a sample solution. It calculates the ZoomGridList values automatically according to the approach above. The example generates collection of 100000 random locations which is used in the ItemsRequest implementation to retrieve locations within the requested square.
I hope it helps.

Greetings,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ed
Top achievements
Rank 1
answered on 14 Apr 2011, 02:37 PM
Thank you for the reply.
The issue of the locations passes to the ItemsRequest method is still there. Do I need to do something once the Map has finished loading before this call is made? Not sure how this could be as it is all automatic.
0
Andrey
Telerik team
answered on 19 Apr 2011, 12:21 PM
Hello Ed,

I am not sure I understood your question completely.
The ZoomGridList property is set in the InitializeDynamicSource method in the project I attached. The ItemsRequest method is called after the DynamicSource property is assigned.
I think you can use the InitializeDynamicSource method as a base for initializing the ZoomGridList in your application.

Regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ed
Top achievements
Rank 1
answered on 19 Apr 2011, 09:24 PM
Let me start back at the beginning. When there are thousands of items to load, the time to bind them to the ItemsSource of the layer is very long. I was hoping that there was a way to load only the visible items, or at least some smaller portion of the whole. I am used to using a bounding box (points that define a geographical rectangle) when retrieving items to display. The simplest way to do this would be to have an event that is raised when a tile is loaded into the map, if the tile had the points that defined its geographical region. I have been trying several ways to do this. One way was to define multiple information layers that covered a part of the geography and load the items by layer. It made no difference as I was still binding the items to the layer. Another issue is that there is no way to signal the map that you want it to reinitialize after being provided with a new center. This comes in to play when I want to move to a different location that will require loading a new set of items to display. I would like to be able to wait to make the request for the items until after the map has finished retrieving and displaying its images. We are taking a very serious look at your controls when we proceed to converting our web site to Silverlight. If we can't get around these issues, it will be hard to do.
0
Andrey
Telerik team
answered on 21 Apr 2011, 04:12 PM
Hi Ed,

It is interesting idea to prevent the items request while the panning is not finished.
I think you can use the CenterChanging and PanningFinished events. You could prevent performing request after the CenterChanging event occurs. And you can allow it when the panning is finished. Also you should call the Refresh method of the dynamic layer after the panning is finished.
I have attached the sample solution.
I hope it helps.

We have created the pits issue for the feature for dynamic layer with the behavior like above.
You can track implementation of this feature using the following link:
http://www.telerik.com/support/pits.aspx#/public/silverlight/5652


Best wishes,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ed
Top achievements
Rank 1
answered on 28 Apr 2011, 02:14 PM
I will document the issue a little better: We have customers who have assets that we want to show on the map. Each asset has a latitude and longitude. Using the collection of assets for a customer, I can define the LocationRect that will contain all of the customer's assets. If I set the GeoBounds of the map to this LocationRect, the display is limited to that Locationrect and I can't pan outside of it as I would expect. However, when the ItemsRequest is made, the ItemsRequestEventArgs defines a bounding box that is many times larger than would be expected, causing many more points to be loaded. The effect of this is to cause the screen to freeze, sometimes for ever. I am using the DyamicLayer and have defined the ZoomGrids to contain 512 Latitudes and 512 Longitudes. I thought that the Items request would be made for each tile. I am using the OpenStreetMap provider. Earlier, I was using the InformationLayer. The load time was quit long as the number of points increased past 1,000. In fact, when trying to load points for a customer with over 30,000 points, it would never finish binding the layer to the list. I am wondering if there is another way to load the points that would increase the speed of the layer binding. I have also noticed that panning and zooming with a large number of points is very slow.
0
Andrey
Telerik team
answered on 04 May 2011, 08:05 AM
Hello Ed,

Thank you for the feedback with additional details.
In fact currently the DyamicLayer does not correspond to new features of the map control. For example it does not allow to use properly the RadMap.GeoBounds property.
We have created the pits issue for redesigning of the DyamicLayer for more usability and performance. You can track implementation of it using the following link:
http://www.telerik.com/support/pits.aspx#/public/silverlight/5817

Regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ed
Top achievements
Rank 1
answered on 31 May 2011, 05:42 PM
I have been thinking about this and wanted to present a possible solution, although without a lot of detail.

What I have noticed is that, when the density of items on the Information or Dynamic layer gets too high, panning and zooming become slow and jittery. This seems to occur when the number of viewable items exceeds about 300. The reason, I believe, is that the position of each item is re-calculated based on the latitude and longitude as the map is panned.

In our current system, we calculate the position of each item one time until the zoom level is changed. It would seem to me that this could be accomplished here as well. If a layer was defined as a canvas so that absolute points could be used and the items placed on it, the canvas could be moved in sync with the map and the individual items would not have to be moved. Additional items could be added as the panning exposed more of the canvas.

What do you think?
0
Andrey
Telerik team
answered on 03 Jun 2011, 07:11 AM
Hi Ed,

The number of the items depends on the complexity of the item template. For very simple templates like Rectangle number of the items can be 2000-3000. More complex templates require more PC resources for rendering, so the number of items decreased.

The information layer doesn't calculate the position of every item when panning. It does it only when zooming. In  short it works similar to your description already.

Kind regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ed
Top achievements
Rank 1
answered on 03 Jun 2011, 06:53 PM
I understand what you are saying. I am using an ellipse. Shouldn't this render at the same speed as a rectangle?
0
Andrey
Telerik team
answered on 08 Jun 2011, 09:53 AM
Hello Ed,

The Ellipse is a bit slower compared to Rectangle, but the difference is so small, so it can be considered as negligible. To be sure that we are talking about the same thing, I've tested productivity of the information layer using following data template:

<DataTemplate x:Key="EllipseTemplate">
    <Ellipse Width="10" Height="10" 
             Fill="Green"
             telerik:MapLayer.Location="{Binding}"
             telerik:MapLayer.HotSpot="0.5,0.5" />
</DataTemplate>

With this data template information layer was able to handle 3000 items with not bad performance.

Greetings,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Map
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or