[postgis-users] point in polygon or equivalent

Darryl Watson dwatson at roof-express.com
Tue Jan 3 08:07:08 PST 2006


Michael:

That is a very clear and excellent explanation of the differences 
between the operator and function internals.  Maybe that should go in 
the wiki and/or FAQ and/or performance tips?  Thanks!

Michael Fuhr wrote:

>On Mon, Jan 02, 2006 at 07:17:00PM -0800, Mark Wright wrote:
>  
>
>>What is the benefit to using the contains() or within() functions
>>rather than the ~ operator? I've tested both and they give the same
>>results in the same amount of time (plus or minus about 20
>>miliseconds).
>>    
>>
>
>The operator checks bounding boxes; the function checks the
>geometries themselves.  Example:
>
>  +-----------+
>  |           | A
>  |   +-------+
>  |   |  +--+
>  |   |  |  | B
>  |   |  +--+
>  +---+
>
>A's bounding box contains B's bounding box so A ~ B would be true,
>but A doesn't actually contain B so contains(A, B) would be false.
>Bounding box searches can use an index so they're a fast way to
>find possible matches; the function identifies matches with certainty
>but it's more expensive, especially for complex geometries, so you
>want to avoid calling it when it's known that it will return false.
>
>  
>

-- 

Darryl Watson                                                         

Senior Software Developer

 

*Roof Express, LLC*

8310 South Valley Highway

Suite 300

Englewood, CO  80112

 

303.524.1193 (direct)

303.524.1101 (fax)

www.roof-express.com/ <http://www.roof-express.com/>

 




More information about the postgis-users mailing list