[postgis-users] Decomposing Multiploygon

Ralph Mason ralph.mason at telogis.com
Tue Dec 16 18:49:26 PST 2003


Thanks for the answer, that did what I need however the performance is 
very poor.

To find the couniries takes 20 ms

SELECT gmi_cntry from countries where 
the_geom ~= GeometryFromText('POINT(-105.0 52.0)',-1)

But

SELECT gmi_cntry from Countries where 
the_geom ~= GeometryFromText('POINT(-105.0 52.0)',-1) and
contains(the_geom ,GeometryFromText('POINT(-105.0 52.0)',-1))

Takes 450 ms which seems like a huge difference.

Is there any way to improve this performance?

Thanks
Ralph


strk wrote:

>See the Intersects(geometry, geometry) function.
>You need GEOS support compiled in.
>
>--strk;
>
>ralph.mason wrote:
>  
>
>>I am new to postgis and spatial data so I apologies in advance if this 
>>is covered already.  Google didn't turn up anything.
>>
>>I have a shape file of country outlines, each country is a multipolygon.
>>
>>I imported this using shp2postgis and created an index on the geometry 
>>column.  So far so good.
>>
>>However, as the a search is done on the bounding box of the multi 
>>polygon I get more than one country returned to many searches.  Eg 
>>querying in canada will return Canada, USA (because of the alaska , 
>>mainland box), and Russia.
>>
>>So - Is there a way to query for records that contain the point in one 
>>of the polygons in the multipolygon?  Or do I need to decompose the 
>>multipolygon to a polygons?
>>
>>Assuming I need to decompose, is there a utility that can do this (I 
>>guess one could write a postgres function to do it)
>>
>>Thanks for any help
>>Ralph
>>
>>
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users at postgis.refractions.net
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>>    
>>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>  
>




More information about the postgis-users mailing list