[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] Decomposing Multiploygon
From: chodgson () refractions ! net
Date: 2003-12-17 17:53:35
Message-ID: 1071683615.3fe0981f70ee0 () hydra
[Download RAW message or body]
Try using:
SELECT gmi_cntry FROM Countries
WHERE the_geom && GeometryFromText( 'POINT(-105.0 52.0)', -1 )
AND distance( the_geom, GeometryFromText( 'POINT(-105.0 52.0)', -1 ) ) = 0;
See http://postgis.refractions.net/docs/x541.html for more info.
HTH.
Chris
Quoting Ralph Mason <ralph.mason@telogis.com>:
> 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@postgis.refractions.net
> >>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >>
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users@postgis.refractions.net
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> >
> >
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic