Wednesday, March 26, 2014

How transform specific geometry column using Django GIS GeoQuerySet

I am trying to transform geometry column type in django, here is my model

class Network(models.Model):      name = models.CharField(max_length=50, blank=True)      alias = models.CharField(max_length=100, blank=True)      geometry = models.GeometryField(srid=3857, null=True, blank=True)      bbox = models.GeometryField(srid=3857, null=True, blank=True)      objects = models.GeoManager()        class Meta:          db_table = u'tbl_network'        def __unicode__(self):          return '%s' % self.name

Problem is that when i tried to transform bbox it does not transform it

  Network(srid=3857).values('geometry','bbox')      SELECT ST_Transform("tbl_network"."geometry", 3857), "tbl_network"."bbox" FROM "tbl_network"

Above query automaticly tranform geomtery field and igonre bbox field

So i tried it different different way

 Network(srid=3857).values('bbox')     SELECT "tbl_network"."bbox" FROM "tbl_network"

Now this query totally ignored transform function.

So my questions is,

How can i transform specific column of model?

thank 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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c95708f5-e6d7-4a80-a929-74e451f33047%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment