ClemensFischer / XAML-Map-Control

XAML Map Control Library
Microsoft Public License
203 stars 59 forks source link

Scalability of MapItemsControl for large amount of points #55

Closed bmulder-innoseis closed 4 years ago

bmulder-innoseis commented 4 years ago

I'm trying to display a lot of points (a simple dot together with a label) on a map using MapItemsControl. When the amount of points gets to ~10k loading, panning and zooming of the map takes a very long time such that it is no longer workable.

Is there any way of speeding up this process or does something other than MapItemsControl exist to render a collection of points (which consist of radius, color, and x/y coordinates together with some text) in a more scalable way?

If not, can you perhaps make a suggestion on how to improve this and/or which parts of the current implementation could contribute to most of the performance overhead of rendering 10000 points?

Thank you for your time, B. Mulder

ClemensFischer commented 4 years ago

Since elements on the map are positioned by standard WPF/UWP layout mechanisms, 10k objects are way too much.

An approach I can think of is to remove the whole layer (i.e. the MapItemsControl) when a map manipulation starts, and put it back in place when the sequence of manipulation events ends. Take a look at how the timer-controlled update mechanism in MapTileLayer works, where a DispatcherTimer is started or reset on each invokation of the Map's ViewportChanged event.

bmulder-innoseis commented 4 years ago

Thanks for your fast reply!

bmulder-innoseis commented 4 years ago

I tried the option you suggested and removed the MapItemsControl temporarily during manipulation with the ViewportChanged event using map.Children.Remove(itemsControl) (and Add them again when the timer expires).

Still, removing the itemsControl takes about two seconds while adding it again takes about 20, so this solution does not seem workable for me, unfortunately.

So I will look if I can either add my points as a static image into a single MapItem somehow or else see if I can make a modified version of Map-Control that uses some kind of clustering library.