Map - marker clustering

Hi,

Is it possible to create map clusters for zoomed out maps. Ive looked around but can not find a solution.

Currently im just adding a small random value to the lat & long so they are not all stitting right on top of each other, but would prefer a nicer solution if possible.

Thanks
Ric

How about a more detailed explanation of what you are attempting to do Ric and a provide a discussion of why you want to do this. If you share the Blocks you are currently using we might be able understand what you mean by map clusters and why you want to create them by adding random values.

Your image suggests you succeeded in creating a 'map cluster' (whatever that is supposed to be), you did achieve a cluster of Markers. If you add random numbers to either the latitude or longitude, you should expect and do get a random pattern of Markers.

What you show in your image is a map zoomed in to tiles of about 18. The Map component will plot these Markers with the pointer at the latitude, longitude pair. If the zoom is such that the separation of the coordinates of the of Markers is less than the distance represented by the width of the Marker pin, the Markers will overlap.

Regards,
Steve

I am trying to avoid having several markers sit on top of each other.
What I would like to do is show a cluster icon like this Clusters

And when you click on a cluster icon the cluster expands so that you can click on each marker individually similar to this. Cluster_expand

I didn't add my blocks because it was a question if It was possible. I have only added a random value to the GPS cord as I want to be able to click on each Marker, which is not possible if they are all stacked on each other. I didn't add blocks as I did not think they were relevant to the question if it was possible or not. but always happy to show.

:cry: OK, this was a test.

Thanks for the Blocks and your description Ric. Populate your Markers from a List of coordinates of perhaps, places and generally, Markers will not overlap. If two markers are adjacent and they are separated by fewer than a few meters, you will not be able to resolve the Bubble pop up for each of the two locations. You may have to zoom in on the Map to allow each Marker to be clicked individually. Locations that are separated by more than a few meters should not have issues clicking a specific Marker. Experiment with a real dataset. If you do have issues with your data set, consider using a CustomMarker a small ball image; one which does not have as large a footprint as the Marker icons.

Have you done the Using the Location Sensor tutorial. Much of what is discussed applies to the Map component.

Here is a tutorial showing an app similar to what you might be trying to achieve >> The National Parks . The tutorial demonstrates how to plot multiple run time markers using a csv file on an OpenStreetMap. Use the list from csv Block to convert the csv to a List. What you do depends on how you make your List, where it is stored or is downloaded from. The coordinates are widely separated in this tutorial; the principles apply if the coordinate set is restricted to a small area too.

Yes, you can do that. Change the zoom when you click an icon; exactly how depends on what you want to happen. If you only want the zoom, that is easy but if you want only adjacent Markers you will have to do some additional programming. Perhaps establishing the distance from the Marker you want to include or resetting the Map Bounds.

Regarding the 20+ and numbered 'clusters' expanding to 20 or so Markers. This is not like Google Maps, MIT's OpenStreetMaps does not have an equivalent group Marker. If you want to expand (or contract) be ready for a lot of programming if it is even possible to reproduce something like your Google map clusters. If you want to do pretty clusters, you will probably need to build your project using the Google Map api, not the MIT Map components. (See this stuff >google maps marker clusters - Google Search

Thanks @SteveJG. I have read through both of them previously. Whilst I appreciate any help, maybe I still haven't explained my self correctly.

That example I showed was from a real data set. That is the issue I'm having. All those points are different Mac address at the one location.

The idea of using a smaller CustomMarker I will try.

Even with my GPS adjustment I Still can not click on each marker individually. If I widen my adjustment too much then my location starts to become incorrect.

I figured that this was not an option like Google maps. I will have a think.. Thanks mate.

Identical location? Then you will get an overlap of icons. You may be able to temporarily hide the icons on top to get to the ones below. I never tried that; it might be possible.

Re-center your map based on the icon you click perhaps. There are two tools you can use for that.

Based on your comments, I would use the Google API with a Static Map and a WebViewer or use a Google javascript solution. MIT Map cannot easily handle your issue. Obtain a Google API key. You don't need a special control to manage a Google Map, just lots of Blocks. Good luck. :slight_smile:

1 Like

With AI2 map component, worth trying the placement of circles, which when clicked will zoom map and generate your marker cluster? A lot of work required....

1 Like