Using ThinkGeo, I have a Lat/Lon coordinate, and a distance of .1 miles. The .1 miles represents the radius of a circle and I'm trying to draw this radius around the lat/lon coordinate.

The map units are in meters, so a quick conversion of .1 miles to meters gives you 160.934 meters. Unfortunately, when this distance is drawn to the map the radius is smaller than what it should be. The radius on the 2D map should be closer to 208.73

After doing some research, I believe this is a projection issue. What I would like to know, is if there is a formula available that can be used to calculate the 2D distance of a line when given the lat/lon of one point and the line distance on the earth.

IE: Coordinate (x, y) should have a .1 mile radius around it. In Map units, this would be 208.73, however I don't know how to go from the .1 mile I have to the .1 mile equivalent on a 2D map.

I am using a Mercator coordinate system, and am basically looking for an OpenLayers equivalent of the ThinkGeo's GetDistanceTo(BaseShape, GrographyUnit, DistanceUnit) function, but I don't think there is one, so I would be forced to come up with my own calculation.

The 208.73 (meters) comes from the ThinkGeo GetDistanceTo()

RadiusInMapUnits = point.GetDistanceTo(new PointShape(polyShape.OuterRing.Vertices[0]),

This works fine in C#, but these functions are not accessible in OpenLayers and therefore I will need to calculate the distance myself in Javascript.

  • 1
    I'm sorry but where are you getting the 208.73 value? Should it be the length in a particular projected CRS? If so, perhaps the calculator is returning the geodesic or great circle distance instead. Plus,what's the coordinate system of the map? – mkennedy Dec 17 '14 at 18:21
  • @mkennedy I've edited my question to provide a bit more info. – leigero Dec 17 '14 at 18:49
  • I am not sure to understand, but I think that you are looking for Vincenty's formula (see Wikipedia for example) – radouxju Dec 17 '14 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.