[postgis-users] st_within too slow?
Obe, Regina
robe.dnd at cityofboston.gov
Sat Aug 30 05:59:34 PDT 2008
Pedro,
Try using st_intersects instead of ST_within. In general I think it performs better than within and for point in poly will be just as good.
Yah Guido's suggestion would be at best give same timing since ST_Within, ST_Intersects have an implicit && call in them so they can limit the number of more painful _ST_Within, _ST_Intersects checks they actually need to do.
Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of Pedro Doria Meunier
Sent: Sat 8/30/2008 8:16 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] st_within too slow?
Dear Guido,
Thanks for replying.
Your suggested mod actually worsens the performance by another ~15-20ms
Best regards,
--
Pedro Doria Meunier <pdoria at netmadeira.com>
> Pedro,
>
> Try this instead:
>
> SELECT road_network, toponymy FROM maps AS m WHERE m.b_box &&
> geomfromtext('POINT($lon $lat)',4326) and
> st_within(geomfromtext('POINT($lon $lat)',4326), m.b_box)
>
> of course, if you already know that the point is in Portugal,
> you could do:
>
> SELECT road_network, toponymy FROM maps AS m WHERE
> m.country = 'PT' and
> m.b_box && geomfromtext('POINT($lon $lat)',4326)
>
> (assuming that the maps table has the 'country' column with
> country names).
>
> GL
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080830/cfffedfc/attachment.html>
More information about the postgis-users
mailing list