Aggregate marker over a region in a map

edited February 2014 in How To...

In a map which has multiple markers showing various coordinates, in a zoom level of 1, I want to show a single aggregate maker for a region instead of multiple small markers. When zooming in to a level 12, I want the individual markers to be shown.

Any advice on how to do this will be of great help.

Tagged:

Answers

  • Use an if clause?

  • Use an if clause in what way? I have the coordinates to each marker on the map. Based on the zoom level, I want to make a cluster of nearby markers.

  • "Use an if clause in what way?"
    In a way fitting to your case? We don't even know how you do "markers", "aggregates", etc.

  • edited February 2014

    I know I was provoking a little bit, but too much is unknown from your original post. Do you define regions using a class, or triangulate them by a given shape or a given area? If you triangulate, how do you place the border of the enclosing regions? Is it important, that a region encloses all your markers, or may markers be divided between to neighboring regions? If markers are unevenly distributed in a region, where do you place the averaged/aggregated marker? In the center of mass or where the density is higher? Are enclosing regions of regular (e.g. triangles, rectangles, hexagons) or irregular (streets, town parts, towns, regions, countries, continents) shape? Are both the density of your markers and the zoom level or only one of these variables determining your level of aggregation? Do you think of a dynamic function that reduces the number of markers depending on the zoom level or is it a simple if clause that just shows all markers if the zoom level is 12 and only one marker if it is below 12?

  • I failed to mention this in my first post, but I am a newbie to processing. Also, any advice on how to implement this will be great since I have to clue on how to implement this.

    To give more details about how I have implemented my code, I am rendering the map using the unfolding library. The markers are based on information of the latitude and longitude of a location.

    I have no way of defining a region right now. What I had in mind, when zoomed out, to replace all the individual small markers with a single large marker, preferably with a different color to indicate a high density of marker. And on zooming in, to gradually increase the number of smaller markers with a lighter color to show decreasing level of density.

  • Unfolding does not have a clustering mechanism built-in. However, if you want to go with your second idea take a look at the ZoomDependentMarkerApp example.

    (You won't need the two populateMarker methods in your app, that's just for testing purposes.)

  • I tried using your code from ZoomDependentMarkerApp. I am getting an error with the package, de.fhpotsdam.unfolding.examples.marker.advanced

    The error is: Unrecognized type:50 (ANNOTATIONS)

Sign In or Register to comment.