Decimal
(1)
Float
(1)
Bytes
(1)
Granularity
(1)
Geography
(1)
Longitude
(1)
Latitude
(1)
Guys
(1)

What's the best data type to store latitude and longitude?

Asked By artist
28-Oct-08 03:53 PM
I have thought about the following:

Decimal(18,15)  (storage is 5 bytes)
float  (4 or 8 bytes)
real (4 bytes)

I'm not sure which one has more advantages among the others.

What do yo guys think?

Thanks

I forgot to mention that I use SQL 2005.

Asked By artist
28-Oct-08 03:59 PM
I forgot to mention that I use SQL 2005.

I'd go with float [8 bytes] unless you can have a pressing need to save space,

Asked By Mr Tea
28-Oct-08 05:07 PM
I'd go with float [8 bytes] unless you can have a pressing need to save
space, can live with the 6 decimal place granularity and go for decimal(9,6)
[5 bytes] instead.

Decimal (18,15) takes 9 bytes of storage and real loses the required
resolution when you get more than 100km from greenwich.

Mr Tea

I forgot to mention that you should upgrade to 2008 and use geography instead

Asked By Mr Tea
28-Oct-08 05:09 PM
I forgot to mention that you should upgrade to 2008 and use geography
instead :)

Mr Tea
Mr Tea, thanks a lot for your detailed help.
Asked By artist
28-Oct-08 05:22 PM
Mr Tea, thanks a lot for your detailed help.
Post Question To EggHeadCafe