[fusion-commits] r1657 - trunk/MapGuide/php
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Nov 10 14:39:53 EST 2008
Author: madair
Date: 2008-11-10 14:39:52 -0500 (Mon, 10 Nov 2008)
New Revision: 1657
Modified:
trunk/MapGuide/php/Utilities.php
Log:
closes #159: WKT is not so WK, add version check to use one version of UTM initialization string or another
Modified: trunk/MapGuide/php/Utilities.php
===================================================================
--- trunk/MapGuide/php/Utilities.php 2008-11-08 21:44:26 UTC (rev 1656)
+++ trunk/MapGuide/php/Utilities.php 2008-11-10 19:39:52 UTC (rev 1657)
@@ -827,6 +827,8 @@
$dimension = $geom->GetDimension();
if ($geom->GetDimension() > 0) {
+ //conver the geometry to UTM auto so that local measurements
+ //are accruate in meters
if ($bNeedsTransform && $srsTarget == null && $srsXform == null) {
$srsTarget = $srsFactory->Create(getUtmWkt($centroid->GetX(),
$centroid->GetY()));
@@ -883,7 +885,12 @@
}
function getUtmWkt($lon, $lat) {
- $epsg42003 = "PROJCS[\"WGS 84 / Auto Orthographic\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Decimal_Degree\",0.0174532925199433]],PROJECTION[\"Orthographic\"],PARAMETER[\"central_meridian\",%.3e],PARAMETER[\"latitude_of_origin\",%.3e],UNIT[\"Meter\",1]]";
+ $siteVersion = explode(".",GetSiteVersion());
+ if ((integer)$siteVersion[0] > 1 && (integer)$siteVersion[1] > 0) { //v2.1.x or greater
+ $epsg42003 = "PROJCS[\"WGS 84 / Auto Orthographic\",GEOGCS[\"WGS 84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Decimal_Degree\",0.0174532925199433]],PROJECTION[\"Orthographic\"],PARAMETER[\"central_meridian\",%.3e],PARAMETER[\"latitude_of_origin\",%.3e],UNIT[\"Meter\",1]]";
+ } else {
+ $epsg42003 = "PROJCS[\"WGS 84 / Auto Orthographic\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Decimal_Degree\",0.0174532925199433]],PROJECTION[\"Orthographic\"],PARAMETER[\"central_meridian\",%.3e],PARAMETER[\"latitude_of_origin\",%.3e],UNIT[\"Meter\",1]]";
+ }
return sprintf( $epsg42003, $lon, $lat);
}
More information about the fusion-commits
mailing list