Postgis Raster Query API Spatial Look up. Intersects problem

10 views
Skip to first unread message

Juan Escamilla

unread,
Jul 4, 2016, 1:04:28 PM7/4/16
to Django users

Dear Developers,

I recently installed the latest Django version (github)  '1.11.dev20160703135514'

To use the spatial lookup API . Specially the GeoQuery.filter(__intersects, something) function.

I've found that the method hangs while executing.

I'm using a very big dataset. If I use a small raster it works without problems.
In any case, there is a function (ST_Polygon) in between that is making a lot of troubles. Seems that everything is faster without it.

Let me show you:

t0.biomeGeometry is a Polygon Field from geodjango model base

DemMexLow is the ModelBase of a raster table.

aa = DemMexLow.objects.filter(rast__intersects=t0.biomeGeometry)

If I retrieve the data it almost never ends. Takes a lot of time.

Examining the raw query I got this:

SELECT "demmex120"."rid", "demmex120"."rast" FROM "demmex120" WHERE ST_Intersects(ST_Polygon("demmex120"."rast"), ST_GeomFromEWKB('\001\003\000\000 \346\020\000\000\001\000\000\000\005\000\000\000\000\000\000\000\000@[\300\000\000\000\000\000\000;@\000\000\000\000\0004[\300\000\000\000\000\000\000;@\000\000\000\000\0004[\300\000\000\000\000\0000;@\000\000\000\000\000@[\300\000\000\000\000\0000;@\000\000\000\000\000@[\300\000\000\000\000\000\000;@'::bytea))


where: demmex120 is the name of the table.

The substring in yellow : ST_Polygon("demmex120"."rast"   is the problem.

If I run the raw sql without the ST_Polygon the query is fast.

What is the purpose of this?


Thank you very much and best wishes

Juan



 

Reply all
Reply to author
Forward
0 new messages