1

I'm working on a project where we have a large number of very detailed polygons being displayed on a image using Openlayers. The polygons are added to the map through a GML feed.

We are having end user performance issues on some of our more complicated polygon feeds. The issues are two fold:

1) The browser will freeze up when loading the polygons from GML initially. After the loading it seems to perform pretty well is there some way to stream the data in slower as to not freeze the browser when the polygons are initially being added to the map?

2) The data payload to the user is too large. We would like to simplify the actual amount of polygon data that is sent to the user. We have our source polygon data in a mysql database, is there an algorithm we could use that would simplify our source polygon data to reduce the number of vertexes?

Some of this may be very basic, sorry I'm pretty new to this stuff.

2

Vector data has very high bandwidth requirements. You should adapt the complexity of the polygons to show only actually visible features, and maybe use a protocol with a smaller footprint (GeoJSON/gzipped?).

The simplification algorithm is called Ramer-Douglas-Peucker, and implemented in many databases and libraries. In PostGIS it would be the ST_Simplify method, but there are mapserver scripts as well.

If you are not bound to OpenLayers, I would recommend you to look into TileStache for server and Polymaps for a client. They allow you to pre-render GeoJSON tiles according to the location/zoom level you are currently looking at.

  • The actual data payload is like 2-3 MB which is very similar to what our competitors pages are so I'm not super concerned with actually delivering the payload. Polymaps looks really cool, but i think lacks some features we need as the the maps are pre-rendered (we need hover effects on the polygons) This is an excellent answer and I thank you for it very much but I guess I was looking for info on how to optimize openlayers . I know that you can override openlayers functionality and I was hoping that I might be able to override a specific function to prevent the browser from locking up. – math0ne Mar 26 '12 at 16:53
  • Thanks for the names of those algorithms too, we're going to look into simplifying our data! – math0ne Mar 26 '12 at 16:59
  • I'm not too certain about openlayers, but in polymaps you can obtain hover effects with css styling. If your polygons have any kind of unique ID, you can achieve hover effects across tile borders with a few lines of javascript. – relet Mar 28 '12 at 10:20

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.