Fossgis: common openlayers mistakes - Till Adams
He has scanned openlayers’ user mailinglist and extracted the top 5
problems/mistakes including the solutions. He gave a presentation two years
ago about “openlayers, das Kartendingsbums fuer jede Webseite” and he’s
surprised at the speed by which openlayers really
The most basic point with openlayers mistakes is discovering and debugging
occured” which provides almost no debugging info. Nowadays it is
Ok, on to the basic mistakes:
- Cross-site scripting. Accessing WFS data from another server, for
solution is to tell your webserver to proxy data from specific hosts via
something provided by openlayers.
- Showing own themes with google and so. Basically: reprojecting google’s
maps into a different projection. That’s not possible. Your WMS data has
to be requested using google’s projection. (The base layer is the boss).
- Projections. Data showing up near the south pole. Or near the African
coast. The problem: your coordinates don’t match your data’s
projection. Using degrees (52 north, 5 east) doesn’t work when the
projection is in meters…
Use something like
map.projection) for instance.
- Performance tips. Use yslow. It
integrates into firebug and gives your page a grade. And it provides hints
on improving your performance like “make fewer http requests” and “put your
js at the end of the page”. A problem: we’re all using tiles to split up the
map. But every tile means an http request. You can swamp your browser when
your tiles are too small and the browser window is relatively big. For some
sites, they’ve switched back to using single tiles. Also you can try and
comments and so.
- Pink tiles. (He didn’t have time for that anymore).