[fusion-commits] r2718 - trunk/layers/MapGuide

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon May 27 21:24:15 PDT 2013


Author: jng
Date: 2013-05-27 21:24:15 -0700 (Mon, 27 May 2013)
New Revision: 2718

Modified:
   trunk/layers/MapGuide/MapGuide.js
Log:
#434: Proj4js is a EPSG-driven system (or at least it works much better with EPSG codes). So when initializing our projection in Fusion.Layers.MapGuide, if we have an EPSG code and a WKT string available, the EPSG code takes precedence.

Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js	2013-05-28 04:20:48 UTC (rev 2717)
+++ trunk/layers/MapGuide/MapGuide.js	2013-05-28 04:24:15 UTC (rev 2718)
@@ -332,10 +332,17 @@
             //set projection units and code if supplied
             var wktProj;
             if (o.wkt && o.wkt.length > 0){
-              wktProj = new OpenLayers.Projection(o.wkt);
+              //Proj4js prefers EPSG codes over raw WKT. So if an EPSG code exists, use that over the WKT
+              if (o.epsg != 0) {
+                wktProj = new OpenLayers.Projection("EPSG:" + o.epsg);
+                this.mapTag.layerOptions.projection = "EPSG:" + o.epsg;
+              } else {
+                wktProj = new OpenLayers.Projection(o.wkt);
+              }
             } 
             if (!wktProj || (wktProj && wktProj.proj && !wktProj.proj.readyToUse)) {
               if (o.epsg != 0) {
+                wktProj = new OpenLayers.Projection("EPSG:" + o.epsg);
                 this.mapTag.layerOptions.projection = "EPSG:" + o.epsg;
               } else {
                 //default to the local non-projected system if not otherwise specified



More information about the fusion-commits mailing list