how to check if a point is contained in a polygon ? - Mailing list pgsql-sql

From Julien Cigar
Subject how to check if a point is contained in a polygon ?
Date
Msg-id 1210177536.2585.15.camel@frodon.be-bif.ulb.ac.be
Whole thread Raw
Responses Re: how to check if a point is contained in a polygon ?
Re: how to check if a point is contained in a polygon ?
List pgsql-sql
Hello,

I'm busy to work on an application where the user can select (with
precision) an area on a map (for example the contours of a lake) and I
have to retrieve all the data (specimen observations) within this area. 

I have a list of coordinates pair [(lat1, long1), (lat2, long2), (lat3,
long3), (..., ...)] which form a polygon. In my database every specimen
has a pair of coordinates where it has been collected.

Is there an SQL function to check if a point is contained in a polygon
shape (before I start to write my own) ?

I tried something like :

rodentia=> select point '(-8,25)' <@ polygon
'((-3,10),(8,18),(-3,30),(-10,20))';
ERROR:  operator does not exist: point <@ polygon
HINT:  No operator matches the given name and argument type(s). You may
need to add explicit type casts.

... but without success as you can see ;\

In advance thanks,
Julien

-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: jcigar@ulb.ac.be
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52



pgsql-sql by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: dbmirror - migration to 8.3 from 7.4
Next
From: Richard Huxton
Date:
Subject: Re: how to check if a point is contained in a polygon ?