Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm having trouble converting a Feature class (shape file) to a DB table (Postgresql 8.4/Postgis 1.5). This is the command in the pg log:

INSERT INTO "public"."distritos" ("Shape" , "DEPARTAMEN" , "DISTRITO" , "CODIGO" , "COD_DPTO" , "COD_DTO" , "Departam_1" , "Codigo_de" , "Codigo_Dis" , "Distrito_1" , "uno" , "dos" , "tres" , "cuatro" , "cinco" , "seis" , "siete" , "ocho" , "nueve" ) 
VALUES (ST_GeomFromEWKT('SRID=32721;MULTIPOLYGON(((468800,82617047 7197312,28691447,467497,41696333 7195434,36685706,467565,26527912 7195335,31905228,467296,09588678 7194813,80725757,467319,59506391 7194417,01803403,467319,95651934 7194268,2014959,467004,71721878 7194168,22045301,466712,139403 7194018,68218605,466667,50146617 7193844,95114294,467209,8235828 7193226,21075235,467661,31307484 7192880,06289891,467910,40970103 7192359,79788845,468699,92768015 7191964,81222265,468499,24533509 7191071,4368485,468365,76444857 7190351,83660322,468231,1250694 7190128,29180745,468366,4653957 7190054,20220858,469066,98539115 7189113,31955145,468864,42575667 7189038,44226612,469788,59217212 7188767,72054056,469699,21918869 7188445,07983016,469632,99209906 7187849,65727227,469656,97413566 7187204,83207603,469817,5905674 7185890,63104716,469867,52349147 7185319,22773178,468658,38379028 7185473,92740897,468281,64633634 7185334,60849811,467946,03954144 7185518,38747909,467864,29364035 7184664,52165417,468578,10776462 7183974,04907692,468576,84476232 7183964,76873693,467850,72183629 7184116,36272805,466947,26662547 7184528,34839159,466307,65830413 7184671,72000468,465705,79829264 7184753,03027828,464050,58816321 7184997,20364955,460758,35671061 7185629,95806058,459598,39686437 7185756,39088849,459584,64610774 7186449,86186351,459512,1106813 7186726,02330998,459529,6194157 7186864,26621989,459672,31399859 7187101,59313871,459868,61595652 7187398,30309252,459921,98283708 7187536,65250183,459777,56301254 7187871,82433671,459830,45824535 7188168,10380134,459864,60163032 7188740,7062706,459899,22006775 7189155,37865539,459808,68924671 7189451,22853258,459807,68483849 7189786,82870513,459842,48190044 7190142,27717342,459733,95380801 7190457,81384916,459482,03178327 7190753,17659113,459301,94405746 7191009,26976572,459300,98741755 7191325,12827641,459444,14396157 7191424,26771655,459434,89415553 7191479,24185981,459407,62422337 7191641,31205099,459281,73981899 7191759,37921654,459209,59092453 7191897,34972155,459208,51266 7192252,69017678,459405,00121258 7192509,92191899,459565,03627605 7192964,4539174,459563,96787252 7193319,79381075,459509,68905576 7193477,56074018,459402,25978609 7193418,01306848,459312,40766142 7193476,96540262,459347,85936272 7193615,26155219,459490,92206147 7193753,88206627,459723,54561042 7193932,25194962,459776,87924731 7194090,34158007,459758,35330869 7194287,69871478,459703,89574359 7194504,68947562,459451,36363753 7194977,72079297,459486,88043962 7195096,27519058,459508,16711412 7195351,19389149,459716,08581899 7195330,37151154,459859,92260493 7195267,56277112,460289,23283441 7195822,17211768,460746,94183859 7196503,32621195,461264,75648828 7196283,49170009,462458,26481436 7195875,82382738,462571,47391096 7196492,71121886,462585,26895696 7196698,27350941,462999,5015449 7197568,94136003,463629,77909065 7198266,2751827,463945,2384375 7198504,26499931,464174,70859224 7198662,97159595,464332,38354865 7198805,67493153,464389,52329338 7198932,30168348,466710,77963525 7200491,45106002,467417,10391212 7199434,2790907,468426,39704753 7197961,13654758,468800,82617047 7197312,28691447)))') , 
'CENTRAL', 'ITAUGUA', '1106', '11', '06', 'Concepcion', '01', '06', 'San Lázaro', 2, 4, 4, 4, 4, 4, 4, 4, 4)

And the error I'm getting is:

ERROR:  parse error - invalid geometry
HINT:  "SRID=32721;MULTIPOLYGON(((468576," <-- parse error at position 33 within geometry

Any ideas?

share|improve this question
1  
HI Federico, what tool/utility are you using for the import? If you're using ogr2ogr, try adding -nlt geometry to your ogr2ogr command. I see that's a MultiPolygon---so if the table includes Polygons and MultiPolygons, ogr2ogr needs to know both geometry types are allowed in the same table, which is what -nlt geometry accomplishes. –  elrobis Apr 19 '13 at 13:48

1 Answer 1

up vote 1 down vote accepted

First and last points have only two coordinates, while other have four. (note the separation of numbers by commas vs. spaces)

This is most likely the cause of the problem

share|improve this answer
    
Yes, that seems to be the problem. I'm using de St-links Conversion tool for the import. I'll have to use some other tool. –  Federico Apr 19 '13 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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