I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913".
function init() {
var options = {
projection: new OpenLayers.Projection("EPSG:4326") // ignored
};
map = new OpenLayers.Map('map', options);
var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender");
map.addLayer(layer);
...
alert(map.getProjection()); // returns "EPSG:900913"
...
}
The base map is open street map.
How can I set the Projection to EPSG:4326?
It is Osmarender that has a hardcoded 900913 projection, nothing to do about that. But have you considered taking things the other way around? Transforming your coordinates or layer to EPSG:900913? Check the documentation here: http://docs.openlayers.org/library/spherical_mercator.html