[postgis-users] Question: How to Select all Points inside a specific polygon

Markus Schaber schabios at logi-track.com
Wed Jan 28 03:54:13 PST 2004


Hi,

On Wed, 28 Jan 2004 12:33:07 +0100 (MET)
"Reinhold Stahlmann" <stahlma at gmx.de> wrote:

> how can I built an (OGC-conform) SQL-Query with PostGis
> to select all Points of a given Point-Dataset who have their 
> Geometry within a specific Polygon-Geometry chosen by a label-Field 
> of the Polygon?
> 
> For example: All PostGIS-Users.name (Point-Geometry) within "Sweden"
> (Polygon-Geometry)
> 
> SELECT PostGIS-Users.name
> >From PostGIS-Users
> WHERE Within(PostGIS-Users.geometry,(Countries.name =
> "Sweden").geometry) = true
> (something like this above)

I think that the intersects(geometry,geometry),
within(geometry,geometry), overlaps(geometry,geometry) and/or 
contains(geometry,geometry) should do what you want, see the postgis
Docs.

HTH,
Markus

-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schaber at logi-track.com | www.logi-track.com



More information about the postgis-users mailing list