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]),
GeographyUnit.Meter,
ThinkGeo.MapSuite.Core.DistanceUnit.Meter);
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.