Support EPSG:3857, EPSG:102113 and EPSG:102100 as additional web mercator aliases. p=tschaub, r=me (closes #2915)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10870 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-11-05 07:49:12 +00:00
parent b9517a4cb5
commit e40bb1f10d
2 changed files with 71 additions and 8 deletions

View File

@@ -186,11 +186,32 @@ OpenLayers.Layer.SphericalMercator = {
};
/**
* Note: Two transforms declared
* Transforms from EPSG:4326 to EPSG:900913 and from EPSG:900913 to EPSG:4326
* are set by this class.
* Note: Transforms for web mercator <-> EPSG:4326
* OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113 and EPSG:102100.
* OpenLayers originally started referring to EPSG:900913 as web mercator.
* The EPSG has declared EPSG:3857 to be web mercator.
* ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as
* equivalent. See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084
*/
OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:900913",
OpenLayers.Layer.SphericalMercator.projectForward);
OpenLayers.Projection.addTransform("EPSG:900913", "EPSG:4326",
OpenLayers.Layer.SphericalMercator.projectInverse);
(function() {
// list of equivalent codes for web mercator
var codes = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100"];
var add = OpenLayers.Projection.addTransform;
var merc = OpenLayers.Layer.SphericalMercator;
var same = OpenLayers.Projection.nullTransform;
var i, len, code, other, j;
for (i=0, len=codes.length; i<len; ++i) {
code = codes[i];
add("EPSG:4326", code, merc.projectForward);
add(code, "EPSG:4326", merc.projectInverse);
for (j=i+1; j<len; ++j) {
other = codes[j];
add(code, other, same);
add(other, code, same);
}
}
})();