Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i am using distanceTo function in OpenLayers Geometry.

http://dev.openlayers.org/docs/files/OpenLayers/Geometry/Point-js.html#OpenLayers.Geometry.Point.distanceTo

here am confused in which format it will return the value. It is in Kilometers or meters?

share|improve this question

1 Answer

up vote 0 down vote accepted

Meters if your map units are in meters (default).

Correction:

Sorry, default is degrees. map units documentation

Defaults to ‘degrees’. Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’.

But you can change that in your map constructor:

var map = new OpenLayers.Map({
    div: "map",
    units: 'm'
});

You can get the units like this:

map.getUnits();
share|improve this answer
thanks.. how to know map units, can u give me example. – Ramesh K Apr 20 '12 at 18:07
I was wrong, please see my update. – CaptDragon Apr 20 '12 at 18:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.