Thursday, March 27, 2014

How transform geometry column using GeoDjango

I am trying to transform geometry column 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' %

I am trying to transform bbox column but GeoQuerySet automatically tranform geometry column


SQL query output of above django query

  SELECT ST_Transform("tbl_network"."geometry", 3857), "tbl_network"."bbox" FROM "tbl_network"

So i tried it different way, now i exclude geometry column


SQL query output of above django query

 SELECT "tbl_network"."bbox" FROM "tbl_network"

Now GeoQuerySet totally ignore transform function.

So my questions is,

How can i transform specific column of model?

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