On 03/27/2014 04:53 AM, Shoaib Ijaz wrote:
>
>>
>> I am doing sql queries in django, the queries that i mentioned above are
>> print queries of django
>
>
> Network.objects.transform(srid=3857).values('geometry', 'bbox')
>
> *This is printed SQL query output of above django query *
>
> SELECT ST_Transform("tbl_network"."geometry", 3857), "tbl_network"."bbox"
> FROM "tbl_network"
>
> Network.objects.transform(srid=3857).values('bbox')
>
> *This is printed SQL query output of above django query *
>
> SELECT "tbl_network"."bbox" FROM "tbl_network"
>
>
I see so the 1st query works and the 2nd one fails to do the transform.
I think the problem may be related to you having 2 geometry columns in
the same Postgis table.
Are both of them listed in the geometry_columns view of Postgis.
Typically only 1 can be the default. In this case geometry, so
Geodjango/Postgis is recognizing it as a spatial column. But when it
get's to bbox it doesn't recognize it and doesn't know what the FROM
(current) srid is so a Transform wouldn't work.
One option would be to return the data and then transform it once you
have the spatial objects into python variables.
Thanks,
Alex
--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/53347120.7000501%40wildintellect.com.
For more options, visit https://groups.google.com/d/optout.