I have quite some large/complex polygons I'd like to overlay on a Google map. I can do this but wondered what the best/fastest way is to load them?

I have tried using a KML but understand there are some limitations on size and the number you can load. Also I've looked at fusion tables but again they have limitations.

I'm thinking about storing the polygons in JSON files split into region A, B, C, etc... then limit the zoom level so that only certain polygons would be visible at one time then only fetching those.

Suggestions welcome.

Thanks Andy


I had a similar problem and used a kml parser (geoxml3) to locally parse a kml. I later ended up storing each kml file as a database table and looping through the records to plot a polygon. Loading the kml from a server was the slowest of all.


Two ways to minimize the size of each request.

1 - Make sure the polygon shapes are smoothed to the resolution. I.e. you don't need to show all the minute bends in the lake if you are viewing it at country level. So if you are going the JSON route, have different JSON files for different zoom levels. I found that having 3 different simplifications worked pretty well for minimizing data transfer.

You can do this in ArcGIS (and I assume QGIS though I don't know it) with the Simplify Polygon tool. Or you can upload shapes to MapShaper (works with Shape files, JSON, and GeoJSON) which is great for seeing how the simplification process works.

2 - Only call for the shapes that are within the viewing box of the browser. Gmaps API should be able to tell you what the current viewing box is. You probably need to use a server/database or use Fusion Tables if you want to implement this, but it significantly cuts down on individual loading times (though there are obviously more of them).

By using a combination of these two strategies, I've lowered loading times by quite a bit.

  • Mapshaper is spot on for minimising json bloat for map coordinates. Thanks – sledgeweight Dec 10 '18 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.