kaoscify
kaoscify

Reputation: 1763

Google Maps addGeoJson Based on Viewport

I am loading 10,000 polygons using map.data.addGeoJson technique in a map all at once — so obviously it takes a while to load them based on the RAM of the computer.

How can I make them load based on the viewport of the computer screen? And load the rest when bounds_changed event is fired?

Upvotes: 4

Views: 946

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

Depends for example if you have also stored the center of the poligon you can query the polygon with the center inside of the bounds of the viewport of the computer screen. Get the bounds is not a problem you can use

 map.getBounds();

The real problem is how you can query the polygon who satisfied the condition for a correct select.

Upvotes: 1

Related Questions