[postgis-users] Optimise this query, point in polygon on quite a large scale

Louis Holford louis.holford at gmail.com
Sun Jun 26 14:02:59 PDT 2011


So...I have a large list of points (~30,000). I need to count the number of
points that overlap a polygon (or multiple polyongs e.g. 100's). Each
polygon represents part of a grid that overlaps the envelope of the list of
points, so I need to know the count of points per grid cell.

Currently I can generate each grid cell "in memory" and feed them to a query
using ST_GeomFromText. Now, I know this takes a long time to complete and is
not optimal.

I would like any opinions as to what the best solution to implementing the
query would be. I am thinking along the lines of generating the full grid as
a table with either each cell stored separately or the whole grid as a
single multipolygon and then performing the ST_Intersects part of the query.

And also I know I should generate an index to help the query
planning/search.

Thanks

-- 
Thanks,
Louis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110626/d005d0f9/attachment.html>


More information about the postgis-users mailing list