Thread: how to use geometric shapes?

how to use geometric shapes?

From
"Henriksen, Jonas F"
Date:
Hi,
I cant seem to figure out how to use the geometric shapes in postgres: my query goes like this:

select lat, lon from toperation
where point'(lat,lon)' @ polygon'((50, 0),(70,10),(80,50),(50,80),(50,0))'

This should fetch all values of lat and lon contained by the polygon, but I dont see how I can fetch the lat and lon
values,I just get errors whatever I do. Can anyone help me on this? Thanx,  

regards Jonas:))

--
Jonas F Henriksen
Institute of Marine Research
Norway


Re: how to use geometric shapes?

From
Tom Lane
Date:
"Henriksen, Jonas F" <jonas.f.henriksen@imr.no> writes:
> select lat, lon from toperation
> where point'(lat,lon)' @ polygon'((50, 0),(70,10),(80,50),(50,80),(50,0))'

I think you're confusing the syntax for point literal constants with the
constructor function that makes a point value from two float8 values.
You probably want something more like

select lat, lon from toperation
where point(lat,lon) @ polygon '((50, 0),(70,10),(80,50),(50,80),(50,0))'

            regards, tom lane