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' %

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
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment