ThinkGeo.com    |     Documentation    |     Premium Support

WKT For a Square Shape is Incorrect

I’m using TrackOverlay to create GeoFencing features into my WinForms application. When I get the WKT though the TrackEnded event, the WKT does not create a square when you calculate the distances.

For example, when I draw a square on my map, I get the following WKT:
POLYGON((-82.0759586090482 40.9941991642239,-81.9876535169284 40.9941991642239,-81.9876535169284 40.9058940721042,-82.0759586090482 40.9058940721042,-82.0759586090482 40.9941991642239))

When you plot those distances (either using the GetLength() method in ThinkGeo or using this website: https://gps-coordinates.org/distance-between-coordinates.php) the sides of the square are not equal. One length comes out to 6.1 miles and the other comes out to 4.61.

I’m thinking that I might have to use some type of offset, but I’ve tried a few things and I can’t figure it out. Any help would be appreciated. Thanks

My map is setup to use DecimalDegree as the MapUnit: winformsMap.MapUnit = GeographyUnit.DecimalDegree;

Below is the TrackEnded method of how I’m getting the WellKnownText:
private void TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
{


shapeCurrentGeoFenceWellKnownText = e.TrackShape.GetWellKnownText();
}

Hi Canon,

That’s related with the projection, your projection is 4326, and your polygon is not plotted near equator, so when you draw a square on map, it’s in fact been a trapezoid in earth.

And the get distance is calculate the distance in earth but not on map.

If you want to draw a square and get a square on map, you should want to choose projection 3857, which can make a better result.

Regards,

Ethan

Thanks very much Ethan! I’ll do that.

Hi Canon,

I am glad to hear that’s helpful.

Any question please let us know.

Regards,

Ethan