Server-side clustering?

I was desperately looking for the right solution that could handle up to 50,000 tokens (and why even more if the server can handle it), being light on my server, and I have been doing this for several days.


The concept looks something like this:

enter image description here


  • What would be the best solution / language for a side clustering server? I'm not looking for a huge working code, but I need to push in the right direction.
  • How to "cache" or "mark" already loaded clusters / markers so that you will not reload markers / clusters that were already loaded when the map was enlarged to / from or locked?

Theory:

The correct path looks something like this:

  • If the map is zoomed out and there are many tokens, perform clustering in the server
  • If the map is enlarged to the point where all the markers are no longer suitable for viewing, only clustered markers that are in the viewport are clustered - and the server
  • If the scale becomes so large that the number of markers in the viewport becomes small (for example, 500), the cluster in the browser through JS

Data that I could use on the server side, and which I could also send to the browser via JSON:

  • Map boundaries sent using ajax to the server when executing a request
  • Total number of tokens from a database query
  • Token coordinates from database query
  • Perhaps something else important / useful that Im currently does not implement
+7
ajax php google-maps google-maps-api-3 markerclusterer
source share
1 answer

I work with Google map applications with 50,000 100,000 polygons. It is very useful to organize polygons into a series of areas (logic sheets, areas or similar). Using an array of already mapped regions, which is sent to the server via ajax along with the coordinates that you linked, allowed me to select only those regions that are not yet displayed, and thus reduce the bandwidth allocation - this is the time for rendering polygons,

The rest of the strategy is correct. for a more thorough assessment, you need to get technically little practical in social like SO.

For the server-side language, everything is in order, I personally right now use PHP and the Yii2 framework with PDO driver for MySQL. It is important to use the environment, which makes it very easy and efficient to access the database.

In these conditions, using a good cluster organization and displaying polygons in regions, when the zoom level allows it to make google maps applications very effective

Please note that the appearance of markers is faster than the appearance of polygons, as there are fewer coordinates and their graphic characteristics.

For a general question like yours, it's hard to find a good answer on the Internet. For regions, it depends on the size of the area you are managing and the average density of markers. For an area not near the pole, you can use part of the coordinate .. or if your geo point has some attribute associated with the area you can use. You can find formulas online to relate the scale to the approximate size of the area. It also depends on how the marker assembly is done. In my case, during the collection, I get some attribute for this.

To check for tokens or a group of tokens already on maps, I just use a vector and use this (via ajax) to dynamically exchange with the server. The formatting time for the vector is empty and gradually the vectore contains an element to “know” what is already displayed.

+2
source share

All Articles