0

i need insert to database this area sample: [ [ [ 50.227886556627098, 31.15709614260982 ], [ 50.227886335531331, 31.157096406770776 ], [ 50.227468173402542, 31.157506958998855 ], [ 50.227886556627098, 31.15709614260982 ] ], [ [ 50.488453280451964, 30.816523649043251 ], [ 50.488472645714253, 30.816523648897526 ], [ 50.488460603560483, 30.816523679582151 ], [ 50.488453280451964, 30.816523649043251 ] ] ]

3
  • 2
    Welcome to GIS SE! As a new user be sure to take the Tour. I recommend that you edit your question to provide some details about what you tried prior to posting your question.
    – PolyGeo
    May 18 '15 at 4:46
  • INSERT INTO xxx(the_geom) VALUES(ST_GeomFromText('POINT(-71.060316 48.432044)', 4326)); Noe replace Point with POLYGON and take your sample string and replace all [] with () then remove , with " " (space) then remove ( ) from coordinate pairs. you should have string like POLYGON((50.2 31.2, 52.2 31.2, ....) May 18 '15 at 6:36
  • have error in insert , that error :geometry has too many points , please help me... May 18 '15 at 7:15
0

Connected to my database world_borders, I did (the first and the last point must be equal):

CREATE TABLE geometries (name varchar, geom geometry);

INSERT INTO geometries VALUES
('Polygon', 'POLYGON((50.488453280451964 30.816523649043251, 50.227886556627098 31.15709614260982, 50.227886335531331 31.157096406770776, 50.227468173402542 31.157506958998855, 50.227886556627098 31.15709614260982, 50.488472645714253  30.816523648897526, 50.488460603560483 30.816523679582151, 50.488453280451964 30.816523649043251))');

Afterward, in QGIS, the polygon (at Iran) looks as:

enter image description here

and much more closer it looks as:

enter image description here

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.