What is the best data type to use when storing geopositional data in C#? I would use decimal for its exactness, but operations on decimal floating point numbers are slower then binary floating point numbers (double).
I read that most of the time you won't need any more than 6 or 7 digits of precision for latitude or longitude. Does the inexactness of doubles even matter then or can it be ignored?
you will not have to do any rounding on your longitude or latitude values, so use whichever one you want. Double is more precise, so let that be the most important factor in your decision.
Decimal degrees (DD) express latitude and longitude geographic coordinates as decimal fractions and are used in many Geographic Information Systems (GIS), web mapping applications such as Google Maps, and GPS devices. Decimal degrees are an alternative to using degrees, minutes, and seconds (DMS).
Longitude and latitude coordinates are stored with 15 decimal digits right of the decimal points.
The GeolocationCoordinates interface's read-only longitude property is a double-precision floating point value which represents the longitude of a geographical position, specified in decimal degrees.
Go for double
, there are several reasons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With