tags:

views:

67

answers:

1

What is the best way to manage GPS coordinates (latitude and longitude) in django models ? I know that there is a module called GeoDjango but reading the tutorial seems dedicated to GIS and not simply to manage the latitude and longitude.

I do not care to have convenient interface for the admin because int the application I'm creatin the admin is virtually absent. But instead the application will often comunicate with mobile device such as iPhone that,for example, treat coordinates as double (double typedef CLLocationDegrees).

I would simply like an easy way to manage these data in the model?

+1  A: 

Save them as double/float with adequate precision in the input data

KevinDTimm
Sometimes it helps to store them as positive numbers with explicit Hemisphere designations of "N", "S", "E" or "W". This is sometimes more helpful than signed numbers. Depends on the application, of course.
S.Lott
I guess this is a descent options, but if you need to do some operations/lookups on the coordinates (eg. distance) i think it's hardly recommend to look into geodjango...
lazerscience
@S.Lott - For display purposes I agree. However, if you're going to use them to plot, the signed format is typically easier as that's what plotters typically accept.
KevinDTimm
distance could be a possibile operation but i don't want to oveweight django with (maybe) unnecessary module.
Luca Bernardi
I was thinking that since the application will often communicate with mobile devices like iPhone, and since the coordinates are defined on the iPhone as a double (double typedef CLLocationDegrees;) maybe double field could be a good choice.
Luca Bernardi
@Luca Bernardi: "I was thinking that..." This is part of your question. Please **update** your question with your thinking.
S.Lott
@luca: GeoDjango can handle such operations via PostGIS so it will actually reduce the load of your site a lot...
lazerscience
@S.Lott i've update my question with the comment information. Thanks!
Luca Bernardi
@Luca Bernardi:"i've update my question with the comment information"? Really? I can't find any of your comment information in the question. For example, the comment says "double typedef CLLocationDegrees". That's not in the question.
S.Lott