[Mapserver-users] PostGIS Spatial Query - Completely Within
Heiko.Kehlenbrink at vermes.fh-oldenburg.de
Heiko.Kehlenbrink at vermes.fh-oldenburg.de
Fri May 30 02:33:17 PDT 2003
Quoting Benjamin Wragg <bwragg at tpg.com.au>:
> Hi All,
>
> I'm currently writing an application with PHP/MapScript which needs
> two
> different types of spatial querying. I currently have one of them
> going
> fine. I select a polygon like a country and search for all other
> polygons in another layer that intersect or fall within the country
> selected. I use the following sql in my where clause:
>
> country.the_geom && otherpolygon.the_geom AND
> distance(country.the_geom,
> otherpolygon.the_geom)=0
>
> What I need to do now is alter this query slightly and only find
> polygons that are completely within the country selected. So if I
> selected the US as the country and in the otherpolygons layer there
> are
> two polygons one covering Texas and one covering the entire earth eg
> (180,90,-180,-90) I would only get Texas back. I've look throught the
> PostGIS docs and can't find any functions that seem to fit. Is there
> any
> PostGIS functions that I can use to accomplish this?
>
hi benjamin,
i think
truly_inside(geometryA,geometryB)
Returns true if any part of B is within the bounding box of A.
should do the job.
you could find infos at the postgis manual, chapter 5, postgis reference,Other Functions.
all the best
heiko kehlenbrink
> Thanks,
>
> Benjamin Wragg
>
More information about the MapServer-users
mailing list