[OpenLayers-Users] Measuring tool
Andrew de Klerk
andrew.deklerk at gmail.com
Wed Mar 19 07:13:17 EDT 2008
How accurate do you need it?. We use a basic function to determine distance
based upon the earth's radius. This IS NOT accurate, but, does work for our
purposes. This functions gets the distance by passing in a vector feature
function ShowMeasureDistance(feature) {
var dist = feature.geometry.getLength();
dist = 6378137.0*(22/7)*dist / 180.0
alert("Distance: " + dist.toFixed(0) + "
m");
mlayer.removeFeatures(mlayer.features);
}
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Gérald Quintana
Sent: 19 March 2008 09:45 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] Measuring tool
Hi,
Once I saw an example of Control to measure the length of a path
(rubber), but I can't find it anymore. Where is it?
I managed to do my own using the DrawFeature control and the
Curve.getLength() method but I miss the conversion factor to get the
distance in meters or kilometers, how can I do it?
Thanks for your help,
Gérald
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.21.7/1334 - Release Date: 2008/03/18
08:52 PM
More information about the Users
mailing list