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