Google Maps addGeoJson Based on Viewport

I load 10,000 polygons using the method map.data.addGeoJsonon the map all at once - so, obviously, it will take some time to load them based on the RAM of the computer.

How can I make them load on the computer screen viewer? And load the rest when the event fires bounds_changed?

+4
source share
1 answer

It depends, for example, if you also saved the center of the polygon, you can request a polygon with the center inside the borders of the viewing window of the computer screen. Get boundaries is not a problem you can use

 map.getBounds();

, , .

+1

All Articles