Setting geodesic: true fixed it. I misunderstood this property. 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.tout...@inspq.qc.ca http://www.inspq.qc.ca
Steve Toutant/INSPQ/SSSS 03/08/2009 11:01 AM A Kwong Hu Kiu <kwon...@hotmail.com> cc users@openlayers.org Objet RE: [OpenLayers-Users] Measure control problem 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.tout...@inspq.qc.ca http://www.inspq.qc.ca Kwong Hu Kiu <kwon...@hotmail.com> 03/08/2009 10:47 AM A <steve.tout...@inspq.qc.ca>, <users@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@openlayers.org From: steve.tout...@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.tout...@inspq.qc.ca http://www.inspq.qc.ca
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users