Needed correct datatype for geo points.
I will get and display it with google map API so format like
- user click on map
- django save this point with additional data
- on next visiting django display this points on map
So, no distances beetween points and etc hacks.
DB: postgres 8
The maximum number of digits allowed in the number. Note that this number must be greater than or equal to decimal_places.
The number of decimal places to store with the number.
which is refering to the Python Decimal
To make good choice about accurate data type and precission you should consider:
- what is minimum possible value (latitude can be from 0 (down)up to (-)90 degrees) _ _.
- what is maximum possible value (longitude can range from 0 (down)up to (-)180 degrees) _ _ _.
- what is accuracy (decimal_places), you wish. Pleas notice that it has impact on zoom level on Google Maps.
By the way, for better understanding, it is good to know how the calculation is done (Python code):
def deg_to_dms(deg): d = int(deg) md = abs(deg - d) * 60 m = int(md) sd = (md - m) * 60 return [d, m, sd] def decimal(deg,min,sec): if deg < 0: dec= -1.0 * deg + 1.0 * min/60.0 + 1.0 * sec/3600.0 return -1.0 * dec else: dec=1.0 * deg + 1.0 * min/60.0 + 1.0 * sec/3600.0; return dec