I have been having a go at drawing a regular polygon, in this example a hexagon, on a map. Not a big one, only 400m radius. I am using the haversine (great circle) formula to generate the points of the polygon from a centre point of coordinates.
The use of the haversine formula seems to be causing a problem in that the polygon is stretched/squashed, and not regular.
I have tried modifying the distance for each point, but this just produces an oddly shaped polygon, or exacerbates the squashing.
I have either missed something, or work is needed either on the formula or elsewhere ? Do I really need a flat earth solution ?
-The OpenStreetMap map is a Mercator Projection. That means there is some distortion when plotting on the may using x and y coordinates The map you see is NOT a Flat map. In this case the North-South coordinates are 'stretched'. If you draw on a Flat map you might realize your expectations. Why? At the equator, a degree of longitude is the same as a degree of latitude , about 69 miles (111 km). But the width of the longitude separation decreases as you move closer to the north pole.
the precision of the points might be insufficient to resolve a regular polygon even on a Flat Map .. a guess but plotting on a Flat Map is what you have to do to see a regular polygon plotted on a surface without distortion.
your version of haversine may not be robust . I haven't had an opportunity to compare with my version of haversine. Movable Type Scripts is a regarded version of the haversine distance calculation so you should get reasonable results if you did the math coorectly.
at 43 N latitude (MIT) one deg of latitude is approximately 111.092 meters. You can check your math by building a hexagon using fixed points. It should be distorted on the Mercator Map Projection.
which is expected. but your hexagon is twice as wide as it it high, so I expect something is wrong with the math . What? At the moment too tired to calculate. Put a scale on your Map and it will be obvious.