# GM15: wrong perimeter and heading

TobWen
Global Mapper UserPosts:

**65**Trusted User
I've just created a bbox with these coordinates in EPSG:31466 (X;Y):

GM15 has calculated its perimeter to 9.999 km - that's wrong of course, should be 10,000.0 km.

GM15 has also calculated the heading between the vertixes: 271.0°, 180.9°, 90.9° - some dirty needle deviation?!

I know, working with floating numbers is always a problem, but that's no good for geoinformation software.

There are a lot of math-libraries to solve the problem. Please don't use any fake rounding to fix it quickly.

2586000.000;5705000.000 2583000.000;5705000.000 2583000.000;5703000.000 2586000.000;5703000.000 2586000.000;5705000.000

GM15 has calculated its perimeter to 9.999 km - that's wrong of course, should be 10,000.0 km.

GM15 has also calculated the heading between the vertixes: 271.0°, 180.9°, 90.9° - some dirty needle deviation?!

I know, working with floating numbers is always a problem, but that's no good for geoinformation software.

There are a lot of math-libraries to solve the problem. Please don't use any fake rounding to fix it quickly.

## Comments

17,238Let me know if I can be of further assistance.

Thanks,

Mike

Global Mapper Guru

geohelp@bluemarblegeo.com

Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation

65Trusted UserSometimes it's needed to calculate with paper coordinates. Could you implement a hidden switch for this?

17,238Thanks,

Mike

Global Mapper Guru

geohelp@bluemarblegeo.com

Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation

65Trusted UserMeasured "on paper", the distance is 1000 m.

Length of the line in GM15 feature information is 1 km (= 1000 m). But why this time?

Normally, you also need to correct the distortion of UTM32 in. The correct length of the line should be 1000.407m.

But:

Actually, you only can measure on ellispoid correctly, if you know the height of the point...

17,238There are differences in measured distance when doing calculations at some elevation. Global Mapper does most calculations at the surface of the ellipsoid, except for a few special places where 3D distances along a terrain surface are also calculated.

Thanks,

Mike

Global Mapper Guru

geohelp@bluemarblegeo.com

Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation

65Trusted UserVincenty is "outdated" since a few years, there a many libraries with higher accurenty and they're open source.

But Vicentiy is okay for most calculations.

17,238Thanks,

Mike

Global Mapper Guru

geohelp@bluemarblegeo.com

Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation

65Trusted UserVincenty's algorithm is based on 1975 math and has many problems, f.e. on nearly antipodal points.

Nowerdays computers can or better

shouldhandle geodetic calculations based on integrals.For my project and calculations, I'm using this one: GeographicLib

It can do 1 nm on distances, 15 nm per vertex in polygons and has solutions for gravity, geoid, and geomagnetic field etc.

It's a C++ class in a MIT/X11 License - give it a try

I'll send you more details about calculating areas and lines in UTM on ETRS89 later (back to the topic).

17,238Thanks,

Mike

Global Mapper Guru

geohelp@bluemarblegeo.com

Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation