Subject: Re: GeoDjango: strip z dimension; force 2D



Jason: when you say create 2 geometry types one with 2 dimensions etc... how do you specify how many dimensions to have?Because I created the field in this way: 
geom = models.MultiPolygonField(geography=True, spatial_index=True)
and let the Django migration do the job, but I don't know how to specify that it's a 3D field.
Thanks

On Tuesday, 8 March 2016 16:34:35 UTC, Jason wrote:I had a similar issue when uploading a kml to geojson conversion to postgis using geodjango.  There is no efficient way to do it in Django, so I ended up doing a workaround
  • Create two geometry types, one with dims=2 and other with dims=3.  Allow both to be null and set default to null
  • When updating, check the geometry dimension via GEOSGeometry.hasz.  If the return is 2, save the geom in the 2D field, otherwise save to the 3D
You can create a save/retrieve method on the model to handle this for you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/073345f1-0a70-4645-9c87-577c89b9a511%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Programming list archiving by: Enterprise Git Hosting