[Mapbender-commits] r7588 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Feb 14 03:59:02 EST 2011


Author: verenadiewald
Date: 2011-02-14 00:59:02 -0800 (Mon, 14 Feb 2011)
New Revision: 7588

Modified:
   trunk/mapbender/http/javascripts/mod_measure.php
Log:
use correct pos values to calculate dist for measuring

Modified: trunk/mapbender/http/javascripts/mod_measure.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_measure.php	2011-02-14 08:17:30 UTC (rev 7587)
+++ trunk/mapbender/http/javascripts/mod_measure.php	2011-02-14 08:59:02 UTC (rev 7588)
@@ -224,15 +224,15 @@
 	var dist;
 	if(mod_measure_epsg=="EPSG:4326"){
 		//convert coordinates to radian
-		var lon_from=(pos.x*Math.PI)/180;
-		var lat_from=(pos.y*Math.PI)/180;
+		var lon_from=(pos[0]*Math.PI)/180;
+		var lat_from=(pos[1]*Math.PI)/180;
 		var lon_to=(mod_measure_RX[mod_measure_RX.length-1]*Math.PI)/180;
 		var lat_to=(mod_measure_RY[mod_measure_RY.length-1]*Math.PI)/180;
 		dist=6371229*Math.acos(Math.sin(lat_from)*Math.sin(lat_to)+Math.cos(lat_from)*Math.cos(lat_to)*Math.cos(lon_from-lon_to));
 	}
 	else{
-		var dist_x = Math.abs(mod_measure_RX[mod_measure_RX.length-1] - pos.x);
-		var dist_y = Math.abs(mod_measure_RY[mod_measure_RY.length-1] - pos.y);
+		var dist_x = Math.abs(mod_measure_RX[mod_measure_RX.length-1] - pos[0]);
+		var dist_y = Math.abs(mod_measure_RY[mod_measure_RY.length-1] - pos[1]);
 		dist=Math.sqrt(dist_x*dist_x+dist_y*dist_y);
 	}
 	if(isNaN(dist) == false && mousepos.x > 0 && mousepos.x < mod_measure_width && mousepos.y > 0 && mousepos.y < mod_measure_height){



More information about the Mapbender_commits mailing list