I am using OpenLayers.Layer.Vector to load and display KML files. Some of the KML files have a large number of points in them (lets say around 20,000). I am surprised they load at all (in chrome), but it unfortunately does take too long.

Would there be any way to speed it up (for example, parse the KML in parts).

  • 2
    The only solution I see is that you show a raster layer (WMS, for instance) instead a vector layer. The con is that you would have to set up a WMS server (for instance with GeoServer or MapServer), or similar. – dariapra Jan 10 '13 at 19:16

Before going to WMS I would ask yourself why you need to load all 20,000 points.

Are your users able to meaningfully visualize that many points? Would you be better served displaying density of points until a specified zoom has been achieved?

After that - the other answers are your best bet. Use a WMS for that much data.

Edit for comment

You could attack this two ways. I would try to let OpenLayers do the work first as this does not require that you generate, serve, and manage the SLD on another layer. Obviously, if performance is still poor, I would render a new layer showing density and turn the 'true' point layer off until a certain zoom level is achieved.

OpenLayers offers some clustering strategies that should do what you want.

  • Thanks. "Would you be better served displaying density of points until a specified zoom has been achieved?" - any pointers as to how I could do this. Is it as simple as having 2 layers, and switching toggling them on and off depending on zoom? would I still need something like GeoServer to provide the postcodes? – zod Jan 14 '13 at 15:16
  • 1
    Here is example for clustering ~14 000 points (to my knowledge): peatus.ee/#route_search It's Google Maps API + third-party clustering code, not OpenLayers, but you should be able to achieve same result with OL. – user1702401 Jan 14 '13 at 16:10

Ultimately you are still having the client load an enormous kml file with that many features. Cached WMS is your best bet.

This article will show you how to set up geoserver in AWS, (assuming you will be deploying outside your network). AWS gives new users 1 year free with a micro instance. Similarly you could sign up for a free openshift account and deploy geoserver there to test out changing this from KML to WMS.


I would prefer to render 20,000 points on map scale basis for creating nice, tidy and fast loading map-as zoom in more point pop up and zoom out less point(and smaller size) pop up using Openlayer SLD.

Example- http://globalmonitoring.sdstate.edu/obesity/model/maps/webgis/ruralhealth.php

  • Your example is a tiled WMS. It is displaying all points at all zoom levels. – Jay Laura Jan 14 '13 at 16:30
  • Thanks Jay. You can also control the visibility of points on scale basis. – EvilInside Jan 14 '13 at 16:33

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.