2

I've tried this a few different ways and keep getting the same error. I have a shapefile currently in WGS84 UTM Zone 15 which is SRID 32615.

I used the ArcMap multipart to singlepart tool to create a singlepart polygon. I followed the instructions found at http://postgis.net/windows_downloads to install postgresql and postgis.

I open pgAdmin III and select the postgis_21_sample table. Plugins > PostGIS Shapefile and DBF Loader 21.

I check connection details and it connects fine. I add my .shp file. I set Schema to public and Table to postgis_21_sample. I leave geo column alone and set SRID to 3265.

When I click import I get

==============================
Importing with configuration: postgis_21_sample, public, geom, C:\GIS\forest_buffer\postgres_single.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=3265
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"."postgis_21_sample" (gid serial,
"shape_leng" numeric,
"shape_area" numeric,
"orig_fid" int4);
ALTER TABLE "public"."postgis_21_sample" ADD PRIMARY KEY (gid);"
Failed in pgui_exec(): ERROR:  function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist
LINE 9: SELECT AddGeometryColumn('public','postgis_21_sample','geom'...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Shapefile import failed.

I've also tried projecting this shapefile to WGS84 with SRID 4326 and receive the same error.

There are >100,000 features and I need to buffer, dissolve, negative buffer, and finally buffer back to the original size to fill gaps. ArcMap and QGIS fail to do it after days of waiting.

  • Wait a second. Did you name the table postgis_21_sample? That's a very odd name for a table but what your script suggests. Is it possible you typed in the database name where the table name goes and you were connected to a different database (like for example postgres database)? – LR1234567 May 7 '14 at 5:37
7

Are you sure you checked whole instruction including creation of new database and spatialy enabled it? You can't import to any of templates, so you have to create new database, connect to it and before import you have to execute query:

CREATE EXTENSION postgis;
  • You are correct! I didn't see those instructions in the bottom corner there. It's odd that I couldn't import to the sample database. I created a new db and ran the query and it all worked. Thank you! – mkmitchell May 6 '14 at 20:50
  • Hmm could be something wrong with the installer. I assume you used the sample database option in the installer. You are right that should have all the postgis extensions already installed. I'll double check our installer to make sure it's properly installing all the extensions in the sample database option. We were thinking of getting rid of that option in the installer anyway. – LR1234567 May 7 '14 at 5:33
  • @mkmitchell - Glad I could help. – Jendrusk May 7 '14 at 8:31
3

Here is the complete steps:

  1. First of all create new database in postgresSQL or select an existing database and ensure you have executed below command.

    CREATE EXTENSION postgis;
    
  2. Open PostGIS 2.0 Shapefile and DBF Loader Exporter (Version may differ as per your installed component)

    enter image description here

  3. You will get below interface after step 2. Just click on view connection detail

    enter image description here

  4. Enter proper credentials database server details and click on OK. You will see below screen/windows

  5. Click on add file -> select appropriate shape file -> options and un-check all the check boxes

  6. Click on import button and you should be happy person on the earth

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.