Django: How to apply filter on geometry type using GeoDjango QuerySet

63 views
Skip to first unread message

Shoaib Ijaz

unread,
Oct 14, 2014, 2:34:05 AM10/14/14
to django...@googlegroups.com

I am trying to convert a SQL into Django Query:

SELECT * from tbl_name where geometrytype(geometry) LIKE 'POINT';

I have searched on it but cannot find any geometry type function.

Any Help? Thank you

Jani Tiainen

unread,
Oct 14, 2014, 3:22:44 AM10/14/14
to django...@googlegroups.com
You can't, at least not with current Django versions. Geodjango assumes
that geometry column contains just one type of a geometries.

But you should be able to use .raw() query to get what you want to.

--

Jani Tiainen

Shoaib Ijaz

unread,
Oct 14, 2014, 4:35:09 AM10/14/14
to django...@googlegroups.com
Yeah, Now I am using .extra() function

Reply all
Reply to author
Forward
0 new messages