[fusion-commits] r1349 - trunk/MapServer/php
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Mar 28 14:53:25 EDT 2008
Author: Assefa
Date: 2008-03-28 14:53:24 -0400 (Fri, 28 Mar 2008)
New Revision: 1349
Modified:
trunk/MapServer/php/Measure.php
Log:
Do not use geos for distance meanure #44
Modified: trunk/MapServer/php/Measure.php
===================================================================
--- trunk/MapServer/php/Measure.php 2008-03-27 20:15:44 UTC (rev 1348)
+++ trunk/MapServer/php/Measure.php 2008-03-28 18:53:24 UTC (rev 1349)
@@ -48,19 +48,14 @@
if (isset($_SESSION['maps']) && isset($_SESSION['maps'][$mapName])) {
$oMap = ms_newMapObj($_SESSION['maps'][$mapName]);
}
- $shapeObj = ms_newShapeObj(MS_SHAPE_LINE);
- $lineObj = ms_newLineObj();
- $lineObj->addXY($x1,$y1);
- $lineObj->addXY($x2,$y2);
- $shapeObj->add($lineObj);
if ($oMap->units == MS_DD)
/*this already returns a meter*/
$distance = distHaversine($x1,$y1, $x2,$y2);
else
{
- $distance = $shapeObj->getLength($shapeObj);
- /*convert to meter*/
- $distance = GetMetersPerUnit($oMap->units)*$distance;
+ $distance = sqrt (pow(($x2 - $x1),2) + pow(($y2 - $y1),2));
+ /*convert to meter*/
+ $distance = GetMetersPerUnit($oMap->units)*$distance;
}
header('Content-type: text/x-json');
More information about the fusion-commits
mailing list