[GIS] Parse error while inserting values into polygon feature

open-source-gispostgispostgresql

I created a polygon as follows

create table boundary (id int, name text);

table created;

select AddGeometryColumn ('',boundary', 'latlon' 4326,'POLYGON', 2);

geometry column added;

then i'm trying to insert values as follows

INSERT INTO boundary (id , name, latlon) VALUES ('1', 'river', GeometryFromTerxt('POLYGON(82.240 16.988,82.243 16.991,82.240 16.988)', 4326));

finally i got an error as follow

<–parse error at position (position number) within geometry.

Best Answer

As commenters point out

  • You need 4+ points to form a closed polygon
  • The first and last point must be the same
  • Polygons can contain multiple rings, so you need two (()) brackets around your exterior ring point list

For example, the unit square

POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))
Related Question