<br><font size=2 face="sans-serif">No, I need planar distance since my
map is in Mercator projection.</font>
<br><font size=2 face="sans-serif">I provided The coordinates of point
1 and point 2 in lat/long just for test purpose.</font>
<br>
<br><font size=2 face="sans-serif">Sorry for the confusion.</font>
<br><font size=2 face="sans-serif">Steve</font>
<br><font size=2 face="sans-serif"><br>
</font><font size=3 color=#0066ff><i>Steve Toutant, M. Sc.</i></font><font size=3><br>
Analyste en géomatique<br>
Secteur environnement<br>
Direction des risques biologiques, environnementaux et occupationnels<br>
Institut national de santé publique du Québec<br>
945, avenue Wolfe<br>
Québec, Qc G1V 5B3 </font>
<p><font size=3>Tél.: (418) 650-5115 #5281<br>
Fax.: (418) 654-3144</font><font size=3 color=blue><u><br>
</u></font><a href=mailto:steve.toutant@inspq.qc.ca><font size=3 color=blue><u>steve.toutant@inspq.qc.ca</u></font></a><font size=3 color=blue><u><br>
</u></font><a href=http://www.inspq.qc.ca/><font size=3 color=blue><u>http://www.inspq.qc.ca</u></font></a>
<p><font size=3> </font>
<p>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Kwong Hu Kiu <kwonghu@hotmail.com></b>
</font>
<p><font size=1 face="sans-serif">03/08/2009 10:47 AM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif"><steve.toutant@inspq.qc.ca>, <users@openlayers.org></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">RE: [OpenLayers-Users] Measure control
problem</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br>
<br>
<br><font size=2 face="Verdana"><br>
I think you are looking for the Vincenty distance formula.<br>
It's included in the examples as well.<br>
<br>
</font>
<hr><font size=2 face="Verdana">To: users@openlayers.org<br>
From: Steve.Toutant@inspq.qc.ca<br>
Date: Mon, 3 Aug 2009 10:44:10 -0400<br>
Subject: [OpenLayers-Users] Measure control problem<br>
<br>
</font><font size=2 face="sans-serif"><br>
Hello,</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
I created a measure control based on the measure.js example</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
My measure control doesn't display the good distance. The distance is longer
than expected.</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
I tried with these coordinates</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
# : lat, long</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
Point 1 : 46.81509864093307, -71.22436522446064</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
Point 2 : 45.54483148742626, -73.63037108350094</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
The control gives 336.824 km</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
It should be around 233 km</font><font size=2 face="Verdana"> <br>
</font><font size=2 face="sans-serif"><br>
Do you have an idea on what could be the cause of this error?</font><font size=2 face="Verdana">
<br>
</font><font size=2 face="sans-serif"><br>
Here is my code</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
//the mapOptions of OL are</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
projection: "EPSG:900913",</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
displayProjection: new OpenLayers.Projection("EPSG:4326"), //Pour
afficher les coord lat long</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
units: "m",</font><font size=2 face="Verdana"> <br>
</font><font size=2 face="sans-serif"><br>
var mesureControl = new OpenLayers.Control.Measure(</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
OpenLayers.Handler.Path, <br>
{</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
persist: true,</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
geodesic: false,</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
handlerOptions: <br>
{</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
// layerOptions: {styleMap:
styleMap}</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
}</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
}</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
);</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
mesureControl.events.on</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
({</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
"measure": handleMeasurements,</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
"measurepartial": handleMeasurements</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
});</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
map.addControl(mesureControl);</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
<br>
function handleMeasurements(event) <br>
{</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
var geometry = event.geometry;</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
var units = event.units;</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
var measure = event.measure;</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
<br>
alert( measure.toFixed(3) + " " +
units, "" );</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
}</font><font size=2 face="Verdana"> <br>
</font><font size=2 face="sans-serif"><br>
//geoExt toolbar</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
action = new GeoExt.Action({</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
control: mesureControl,</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
map: map,</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
toggleGroup: "map",</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
iconCls: 'measure',</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
tooltip: 'Mesure linéaire'</font><font size=2 face="Verdana">
</font><font size=2 face="sans-serif"><br>
});</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
toolbar.push(action);
</font><font size=2 face="Verdana"> <br>
</font><font size=2 face="sans-serif"><br>
Thanks for your help,</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
Steve</font><font size=2 face="Verdana"> </font><font size=2 face="sans-serif"><br>
</font><font size=3 color=#0066ff face="Verdana"><i><br>
Steve Toutant, M. Sc.</i></font><font size=3 face="Verdana"><br>
Analyste en géomatique<br>
Secteur environnement<br>
Direction des risques biologiques, environnementaux et occupationnels<br>
Institut national de santé publique du Québec<br>
945, avenue Wolfe<br>
Québec, Qc G1V 5B3 Tél.: (418) 650-5115 #5281<br>
Fax.: (418) 654-3144</font><font size=2 color=blue face="Verdana"><u><br>
</u></font><a href=mailto:steve.toutant@inspq.qc.ca><font size=3 color=blue face="Verdana"><u>steve.toutant@inspq.qc.ca</u></font></a><font size=2 color=blue face="Verdana"><u><br>
</u></font><a href=http://www.inspq.qc.ca/><font size=3 color=blue face="Verdana"><u>http://www.inspq.qc.ca</u></font></a><font size=2 face="Verdana">
</font><font size=3 face="Verdana"><br>
</font><font size=2 face="Verdana"><br>
</font>
<br>
<br>
<br>