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.

When I try export a pipe network shape to postgis i get this error:

Problema inserindo feições do arquivo:
C:/PP/gvSIG_Projects/Shapes/Abastecimento/QGIS_VATROCOADUTOR.shp

Ocorreu um erro no banco de dados ao executar este SQL:
SELECT AddGeometryColumn('public','QGIS_VATROCOADUTOR','the_geom',-1,'NULL',2)
O erro foi:
ERROR:  Invalid type name "NULL(2)" - valid ones are:
    POINT, MULTIPOINT,
    LINESTRING, MULTILINESTRING,
    POLYGON, MULTIPOLYGON,
    CIRCULARSTRING, COMPOUNDCURVE, MULTICURVE,
    CURVEPOLYGON, MULTISURFACE,
    GEOMETRY, GEOMETRYCOLLECTION,
    POINTM, MULTIPOINTM,
    LINESTRINGM, MULTILINESTRINGM,
    POLYGONM, MULTIPOLYGONM,
    CIRCULARSTRINGM, COMPOUNDCURVEM, MULTICURVEM
    CURVEPOLYGONM, MULTISURFACEM, TRIANGLE, TRIANGLEM,
    POLYHEDRALSURFACE, POLYHEDRALSURFACEM, TIN, TINM
    or GEOMETRYCOLLECTIONM
CONTEXT:  SQL statement "SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6,$7)"
PL/pgSQL function addgeometrycolumn(character varying,character varying,character varying,integer,character varying,integer,boolean) line 5 at SQL statement

I can't interpret this error can you help me, thanks

share|improve this question
1  
How was the shapefile created? How are you trying to import it (which tool)? –  underdark Apr 20 '13 at 19:31
1  
Whichever method you are using for the import, I think an important clue is where the error states: Invalid type name, Null(2). You need to actually specify which geometry type you are importing. –  Get Spatial Apr 20 '13 at 21:31

2 Answers 2

If you look at the function definition at http://postgis.net/docs/AddGeometryColumn.html

you see that the parametres should be

  • schema_name
  • table_name
  • column_name
  • SRID
  • type
  • dimension
  • use_typmod=true

Your function call does not state a correct value for type (point, line, polygon), and I wonder if SRID=-1 is intended.

share|improve this answer
    
Hi, thanks for your help. I has used spittool in Qgis to try the export. I was trying export lines but in the tool I don't see any option to choose that. –  Paulo Praca Apr 22 '13 at 6:59
    
Maybe the same problem as here: gis.stackexchange.com/questions/29128/…. Have you tried simple copy and pasting all elements of the shapefile and inserting in an existing postgis layer? –  AndreJ Apr 22 '13 at 8:18

I solve the problem, I have imported from pgAdminPlugin, and in options I change UTF-8 to LATIN1, and everything worked ok.

Thanks for you help, Paulo Praça

share|improve this answer

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.