I have 3000+ polygons which represent watersheds (18 main watersheds). At the first stage all the 18 watershed will show and their list will be placed in the left sidebar. If any user mouse over the map only popup will show the watershed name. If any user click on any major watershed on map it will open pop up window with detail. At a larger zoom, all watersheds will show.

I'm asking for your advice which open-source solution is the best for handling that large amount of polygons?

I was thinking about Leaflet or OpenLayers but I don't know can they handle large amounts of polygons.

Also, do you suggest do store them in mysql or?

  • 3
    Can you rasterize these polygons? or perhaps use a feature server such a geoserver or featureserver? – dassouki Aug 29 '12 at 16:33

I would create a image service (raster layer) and serve it out with Web Map Service (WMS). This way you can use any API framework which you feel comfortable with as long as it supports WMS (OpenLayers does). You can use WMS to show a layer of all polygon features then use WMS's GetFeatureInfo onclick to pull up information on that polygon.

If for any reason you need the vector data on the map, you could create it dynamically onclick with the GetFeatureInfo response data.


See TileMill, which can rasterize UTFGrid interaction into an MBTiles file and host it on MapBox or an open-source MBTiles server implementation like TileStache.

Here's it with lots and lots of polygons. This approach requires you to rasterize - aka bake - tiles, but is essentially the only way to do what you want without having massive server resources, a custom app, or a very restricted set of browsers.


Scale dependency and a spatially indexed database will be key to this issue. You should be able to represent watersheds using at least two, possibly three or four, levels. For example, you could divide the data into Major (the 18), Minor (some combination of all mid-scale watersheds that all fall within the same Major), and Tertiary (the 3000 polygons). This would give you three different vector layers/services.

Use scale dependency to draw only the appropriate service depending on the user's zoom level.

Use a database with spatial indexing to ensure the services draw quickly, and draw only the portion that is needed to fill the current view window.

Alternatively, you might consider creating tiles of the watershed maps (again, created based on appropriate scales for each layer) and serve them that way.

Alot of questions already exist on this site that recommend appropriate open source solutions to employ these strategies.


In addition to TileMill you could check out MangoMap, it's not open source but it is currently free and is capable of handling this type of data.

[Disclaimer: I work with MangoMap, but am answering because it's appropriate in this case]

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