Closed (won't fix)
Project:
Location
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2010 at 13:56 UTC
Updated:
12 Apr 2010 at 05:40 UTC
when using gmap to set locations, the lat/lng are very precise:
37.5769636963459,-96.3864898681641
but when it is saved, it doesn't save all that.
is there any reason not to crank the precision up a bit?
Comments
Comment #1
yesct commentedtagging, needs someone who understands the module to comment (although others are welcome to comment too! It makes it easier for a maintainer to comment if others have thought through something first)
Comment #2
hutch commentedIn location.install
shows as
decimal(10,6)
in phpmyadmin
to get the full accuracy (with one more for comfort)
decimal(18,14)
would be required, so
should do it, same for latitude of course.
I notice that what google returns are not always the same length, and users might adjust them afterwards so there might be an argument for using 20 and 16, that would cover it for sure.
Comment #3
yesct commentedIs there any reason to not use the most precision possible?
Is there a compelling use case for making precision a setting?
Comment #4
hutch commentedI could imagine that a large site doing a lot of proximity searches might prefer a smaller field, this would speed up the calculations I would think, but for most cases I would prefer the high precision. I already use decimal(20, 16) on the sites I host, I adjusted it immediately after install.
The decimal data type in mysql truncates the number if the number coming in is longer than the space available.
Conversely if the number is shorter it is padded out with zeroes.
Geocoded lat/lons coming in from Google have a precision of 6 or sometimes 7, but if users adjust them afterwards a much higher precision can be achieved.
So overall I would vote for a change to a higher precision, this would have to be an update function in location install.
Tricky, it is done in the table creation routine in location.install. A quick look at the php manual does not show up a good way to adjust the number and even if you did it would still be stored in whatever the lat/lon fields are set up to take, pointless really.
Having said all this I looked it up on wikipedia:
http://en.wikipedia.org/wiki/Decimal_degrees
This states that
6 decimal places is accurate to approx. 0.111 m
That's about 10 centimeters or 4 inches
So perhaps we should just leave it as it is ;-)
Comment #5
yesct commentedGood detective work.
HA. I agree 10 centimeters or 4 inches... we can leave it as is.