OpenLayers projection class
So far, we've been talking about the abstract idea of a projection. Let's dive into OpenLayer's Projection class,
OpenLayers.Projection
, which is what we use to actually handle projections. The Projection class relies on an external library called Proj4js, which can be found at http://proj4js.org. First, we'll talk about what we can do without the proj4js library, and then talk about what we can do with it.
Creating a projection object
To instantiate an object from the Projection class, the code would look like the following:
my_proj = new OpenLayers.Projection('EPSG:4326', {});
Parameters
Let's take a look at the parameters for the Projection class.
projectionCode: {String}
: A string of identifying the Well Known Identifier (WKID) for the projection, such as an EPSG code in the form ofEPSG:4326
.options:{Object}
: An optional object. For instantiating projection objects, it is very common to leave this out.
When creating a map and specifying the projection property,...