Hello,
I am looking for some help in optimizing a query.
I have a table with bounding boxes and sometimes I need to find if a new
given polygon can be fully covered by existing bounding boxes of my table.
Right now I can find it out by summing the areas of intersections between my
polygon and those in my table and comparing this computed area with my
polygon area.
Here's the query :
SELECT ST_area(ST_GeometryFromText('POLYGON((-1 0, -1 1, 1 1, 1 0, -1 0))',
4326) ) -
(SELECT SUM(st_area(st_intersection(the_geom,
ST_GeometryFromText('POLYGON((-1 0, -1 1, 1 1, 1 0, -1 0))', 4326) ) ))
FROM tests WHERE the_geom &&
ST_GeometryFromText('POLYGON((-1 0, -1 1, 1 1, 1 0, -1 0))', 4326) )
=> if query returns 0 then my polygon can be fully covered if != 0 then it
can't.
But I was wondering if there couldn't be an easier way to do this.
Thank you.
Nicolas.
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users