O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with projections

In contrast to other JavaScript mapping libraries, OpenLayers allows working with a great number of projections.

Usually, we specify the desired projection for the map. Later when adding a vector layer to the map, we need to specify to the layer projection so that OpenLayers transforms features from the layer's projection to the map's projection.

But, by default, OpenLayers has a great limitation on projections: we can only use EPSG:4326 and EPSG:900913. Why? Because transforming between projections is not a simple task and there are other great projects that can make it.

So, when we want to work with projections other than EPSG:4326 and EPSG:900913, OpenLayers uses Proj4js Library (http://trac.osgeo.org/proj4js).

Note ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required