I am studying this topic. As far as I found, the coordinates you get from the geophysical library are in the SRID 4326 format, so you can store them in a geometry type without any problems. This will be an example of a GeoDjango model using geometry:
class Landmark(models.Model): point = models.PointField(spatial_index = True, srid = 4326, geography = True) objects = models.GeoManager()
By the way, be very careful to pass longitude / latitude to PointField, in that exact order. geophysics returns latitude / longitude coordinates, so you will need to cancel them.
To convert points in one coordinate system to another, we can use GEOS with GeoDjango. In this example, I will convert the point in 4326 to the famous Google 900913 forecast:
from django.contrib.gis.geos import Point punto = Point(40,-3) punto.set_srid(900913) punto.transform(4326) punto.wkt Out[5]: 'POINT (0.0003593261136478 -0.0000269494585230)'
Thus, we can store coordinates in projection systems that will have better math performance. To display points on a Google map in the admin interface. We can use this wonderful article .
I decided to continue working with types of geography, and I will convert them in the future if I need to improve performance.
maraujop
source share