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: [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>

> 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.
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to