Hi
I am wondering if it is possible to use the clustering features available in RadMap to be able to group moving map markers?
For example 1) Two vehicles driving next to each other along a road show as a moving cluster
For example 2) Two vehicles driving towards each other on a road, cluster when close to each other, then separate when they have passed each other
In both examples, can the cluster(s) be recalculated when marker locations change so that the cluster marker moves / de-clusters as appropriate?
I understand that the clustering features work great with static markers (like in the 'airports' example) and I understand that clusters can be regenerated on a map zoom but I cannot see a way to regenerate, move and possibly break-up a cluster on a marker location change.
Am I missing something obvious?
Thanks
10 Answers, 1 is accepted
The clustering is updated also when you change the Location of the items. Which means that if the clustering feature is adjusted properly when two or more items overlap one another they should be clustered automatically. For your convenience I prepared a sample project demonstrating such set up. Please give it a try and let me know if it works for you.
Regards,
Martin
Telerik
Hi Martin,
I'm implementing clustering so I downloaded the sample app you attached (all I've done is replace the references with the no-xaml telerik dlls we are using). When I click the buttons the items seem to randomly disappear from the map? It looks like the map doesn't refresh correctly. I've attached my version of the sample (renamed as png).
What am I doing wrong?
Thanks
Pete
Hello Peter,
It seems that this is an issue with the clustering feature of RadMap. I've logged it in our feedback portal where you can track its status. I also updated your Telerik points.
To work this around, you can reset the clustering when a shape's Location is updated.
private void Button_Click(object sender, RoutedEventArgs e)
{
this.marker1.Location = new Location(this.marker1.Location.Latitude, this.marker1.Location.Longitude - 1);
this.marker2.Location = new Location(this.marker2.Location.Latitude, this.marker2.Location.Longitude + 1);
this.layer.ClusteringEnabled = false;
this.layer.ClusteringEnabled = true;
}
Regards,
Martin Ivanov
Progress Telerik
Hi Martin,
Thanks for responding so quickly. I'm glad to hear that it's a bug and will be fixed at some point. Please note however that in our application it is affecting any item type in the layer (not just map shapes)
Unfortunately your workaround may not work well for me. We have many layers on our map and the object with changing location does know which layer it is on. Furthermore the workaround affects all objects on that layer (there may be hundreds of affected objects).
Thanks
Pete
Hello Pete,
I am afraid that at this point, this is the only workaround that I can suggest. We will further investigate the issue and try to fix it on our side as soon as possible, but we cannot bound to a timeframe for this. Stay tuned by following the feedback item in the portal.
Regards,
Martin Ivanov
Progress Telerik
Hi Martin,
I added the two lines you suggested to the button click event of the sample. Although it seems to work for a bit, I can click the button sometimes and it generates a NullReferenceException which crashes the application. Please see attached image.
Hello Pete,
You are right. There is an error with this workaround. However, I am afraid that currently, there is no alternative solution that I can provide. What I can suggest you is to follow the feedback item and test the fix when it is available.
Regards,
Martin Ivanov
Progress Telerik
Hi Martin,
I posted a comment on the linked issue in your feedback portal. Not sure if comments on completed tickets get looked at so I'm reposting my question here:
Can you please confirm what the resolution of this item was? Is the problem fixed in Release LIB 2020.1.210 (2/10/2020). Does this mean that the workaround is no longer required?
Thanks,
Pete
Hello Pete,
I already replied in the feedback portal. Yes, this is fixed and you should not need the workaround anymore.
Regards,
Martin Ivanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.