1

I need to convert a shapefile (either polygon shp with millions of polygons or polyline shapefile derived from the polygons) into a format to use online in Google Maps. I currently use GDAL codes including MapTileCluster Pro to create image tiles of high resolution rasters to display via the Google Maps web interface, which works very well. My problem is displaying very large vector files that well exceed the limits for KML files in Google Maps (https://developers.google.com/kml/documentation/mapsSupport).

I have tried a variety of different methods in converting shapefiles to KML, which is a pretty trivial process for smaller datasets (ArcGIS, ogr2ogr, Global Mapper, etc.).

I have also tried burning the vector files to a raster using ogr2ogr and ArcGIS polyline to raster tool; however, the raster looks good either zoomed in or zoomed out, pending the raster size, not not both.

I would like suggestions on how to display large vector files (millions of polygons) via Google Maps.

Thanks, Matt

3 Answers 3

2

Here is a rather simplistic answer because looks like you have tried quite a lot of optimizations, but thought I should mention WMS and Tile Cache here.

If you import your shapefile into a spatial database like PostgreSQL with postGIS, You could use something like GeoServer or MapServer on top of the database table to generate a WMS Layer. Now using SLD (WMS rendering rule format similar to xml). You can define rules to specify which polygons are to be rendered at what zoom levels (or other conditions). Even if you wanted to display all polygons in one go, your WMS will sure take a long time to render , but you can use it with something like GeoWebCache (comes bundled with GeoServer), to cache the tiles so you can boost your performance.

You can then overlay this WMS layer on top of Google Maps.

**Updates based on your comments

Some good links to start with are:

  1. GeoServer

  2. GeoServer User Manual

  3. Workshop on loading spatial data in PostGIS

  4. GeoWebCache

  5. WMS Layer on Google Maps

This should get you started. Let me know if you get stuck at something specific. Hope this helps you get a solution.

2
  • Thank you for your comments. This sounds like it be a good path. Do you have any recommended sites or "how-to" documents to get me started and learning about this? Jun 10, 2013 at 13:32
  • updated my answer
    – Shaunak
    Jun 10, 2013 at 13:41
1

have you tried to work with geojson? there is no sizelimit for a json object as far as i know and you can make some benefit in performance by using ajax as it is covered here

0

Matthew!

Do you consider CartoDB as an option? It's only disadvantage is cost, when you have a really really huge dataset. Other than that I think it is an ideal solution. It offers you an API together with the ability to overlay geometries on a Leaflet/Google Map as tiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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