1

I am trying to import some shapefiles into postgis. Now I have an example database within my download of postgis. In this database I can import the shapefile by changing the DBF file character encoding to LATIN1, from the default UTF-8.

When I create my own database and schema the same pattern does not work. The error message received when I use LATIN1 is:

Importing with configuration: gem_2014, public, geom, C:\Users\Sven\Folderstructuur_GIS_Viewer\Brondata_CBS\gem_2014.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=28992
Shapefile type: Polygon
PostGIS type: MULTIPOLYGON[2]
Failed SQL begins: "SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "public"."gem_2014" (gid serial,
"gm_code" varchar(6),
"gm_naam" varchar(60),
"water" varchar(4),
"aant_inw" numeric(10,0),
"aant_man" numeric(10,0),
"aant_vrouw" nume"
Failed in pgui_exec(): ERROR:  function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist
LINE 46: SELECT AddGeometryColumn('public','gem_2014','geom','28992',...
                ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Shapefile import failed.

When I use UTF-8 it gives:

Importing with configuration: gem_2014, public, geom, C:\Users\Sven\Folderstructuur_GIS_Viewer\Brondata_CBS\gem_2014.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=28992
Shapefile type: Polygon
PostGIS type: MULTIPOLYGON[2]
Failed SQL begins: "SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "public"."gem_2014" (gid serial,
"gm_code" varchar(6),
"gm_naam" varchar(60),
"water" varchar(4),
"aant_inw" numeric(10,0),
"aant_man" numeric(10,0),
"aant_vrouw" nume"
Failed in pgui_exec(): ERROR:  function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist
LINE 46: SELECT AddGeometryColumn('public','gem_2014','geom','28992',...
                ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Shapefile import failed.

For anyone trying to reproduce the situation I am using the following dataset: gem_2014 which can be downloaded from the Dutch national bureau for statistics: http://www.cbs.nl/nl-NL/menu/themas/dossiers/nederland-regionaal/publicaties/geografische-data/archief/2015/wijk-en-buurtkaart-2014-art.htm

I have postgres/gis 9.2

I am especially curious to why it does not work. Because I am planning to work more with Postgis I'd like to understand the problem I have now.

  • When posting this message I noticed the following part: SET STANDARD_CONFORMING_STRINGS TO ON. I just checked it and it is set on ON. – Zuenie Aug 21 '15 at 19:03
  • 2
    Did you enable PostGIS in your new db? CREATE EXTENSION postgis; – underdark Aug 21 '15 at 19:32
  • You sir are my hero. Could you explain why my postgis is not automatically activated in a db when I have postgis installed? – Zuenie Aug 21 '15 at 20:44
  • You're welcome. I'm not sure why it has to be this way. – underdark Aug 21 '15 at 21:08
1

for more info check: Enabling PostGIS

PostGIS is an optional extension that must be enabled in each database you want to use it in before you can use it. Installing the software is just the first step. DO NOT INSTALL it in the database called postgres.

Connect to your database with psql or PgAdmin. Run the following SQL:

-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;

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.