Re: Proper entry of polygon type data

Started by Brent Woodalmost 17 years ago4 messages
#1Brent Wood
b.wood@niwa.co.nz

Hi Peter,

If you want to use Postgres to store/manage/query spatial data, I strongly recommend you look at PostGIS, & not the native Postgres geometry types.

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand

Peter Willis <peterw@borstad.com> 03/24/09 10:35 AM >>>

Hello,

I would like to use 'polygon' type data and am wondering about
the entry format of the vertex coordinates.

Are the coordinates of the polygon type to be entered one
entry per polygon vertex, or one entry per polygon edge segment?

For example:
I have a triangle with vertex corners A, B, C.

One entry per vertex format suggests

INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Cx,Cy)) );

One entry per edge format suggests

INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Bx,By),(Cx,Cy),(Cx,Cy),(Ax,Ay)) );

Which entry format is the correct one?

If per vertex format is the correct one, do I need to
'close' the path by entering the first vertex again at the end of the
list?

ie:
INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Cx,Cy),(Ax,Ay)) );

Thanks,

Peter

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

#2Peter Willis
peterw@borstad.com
In reply to: Brent Wood (#1)

Hi Brent,

I am aware of PostGIS and already use it. My question was regarding
the entry format of PostgreSQL polygon data. There is a void
in the PostgreSQL documentation regarding this.

Incidentally, PostGIS uses PostgreSQL polygon, point, and path
data types.

Using PostGIS for simple , non-geographic, polygon rules is a
bit like using a tank to kill a mosquito.

Peter

Brent Wood wrote:

Show quoted text

Hi Peter,

If you want to use Postgres to store/manage/query spatial data, I strongly recommend you look at PostGIS, & not the native Postgres geometry types.

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand

Peter Willis <peterw@borstad.com> 03/24/09 10:35 AM >>>

Hello,

I would like to use 'polygon' type data and am wondering about
the entry format of the vertex coordinates.

Are the coordinates of the polygon type to be entered one
entry per polygon vertex, or one entry per polygon edge segment?

For example:
I have a triangle with vertex corners A, B, C.

One entry per vertex format suggests

INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Cx,Cy)) );

One entry per edge format suggests

INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Bx,By),(Cx,Cy),(Cx,Cy),(Ax,Ay)) );

Which entry format is the correct one?

If per vertex format is the correct one, do I need to
'close' the path by entering the first vertex again at the end of the
list?

ie:
INSERT INTO my_table (my_polygon_column)
VALUES ( ((Ax,Ay),(Bx,By),(Cx,Cy),(Ax,Ay)) );

Thanks,

Peter

#3Mark Cave-Ayland
mark.cave-ayland@siriusit.co.uk
In reply to: Peter Willis (#2)

Peter Willis wrote:

I am aware of PostGIS and already use it. My question was regarding
the entry format of PostgreSQL polygon data. There is a void
in the PostgreSQL documentation regarding this.

Incidentally, PostGIS uses PostgreSQL polygon, point, and path
data types.

Errr... no it doesn't. PostGIS uses its own internal types to represent
all the different geometries, although it does provide a cast between
the existing PostgreSQL types as an aid for people wishing to migrate.

Using PostGIS for simple , non-geographic, polygon rules is a
bit like using a tank to kill a mosquito.

Interesting metaphor... ;)

ATB,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

#4Peter Willis
peterw@borstad.com
In reply to: Mark Cave-Ayland (#3)

Mark Cave-Ayland wrote:

Peter Willis wrote:

Incidentally, PostGIS uses PostgreSQL polygon, point, and path
data types.

Errr... no it doesn't. PostGIS uses its own internal types to represent
all the different geometries, although it does provide a cast between
the existing PostgreSQL types as an aid for people wishing to migrate.

I stand corrected I guess.
The last time I looked at the actual guts of PostGIS was
WAAAAYYYYY back. And that was long before I actually started
using it.

...of course, my WAAAYYYY back memory may be crossed with my WAAAYYYYY
back forgetfulness, there as well....

Peter