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.

  • GeometryFromTerxt is spelt wrong? is that what you actually entered? – Ian Turton Oct 22 '12 at 12:23
  • 1
    Also 3 points isn't enough to form a valid polygon, you need a minimum of 4 points. – Ian Turton Oct 22 '12 at 12:24
  • The value of "position number" would be useful, but if your code here is a faithful representation of what you actually did, I would focus on the typo in "Terxt" :-). – whuber Oct 22 '12 at 15:27

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))
  • Thank you very much "Paul Ramsey" finally I created a polygon. My mistake is as you mentioned missing of two braces in POLYGON Feature. – Satya Chandra Oct 23 '12 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.