[postgis-users] Unable to import shapefile using Shapefile toPostGIS Importer

Paragon Corporation lr at pcorp.us
Thu May 17 16:19:02 PDT 2012


Smaran,
 
This error usually happens for one of 2 reasons
1) You are trying to import into a database that is not PostGIS enabled
2) You installed PostGIS in a schema other than public and did not add that
schema to your search_path.  
(this you can fix by adding the schema to your database search path --
pgAdmin has it under variables, or you can run something like
 
ALTER DATABASE set search_path=public,the_schema_you_installed_postgis_in
 
To verify one of these is the issue run this command:
 
SELECT postgis_full_version();
 
If it fails one of the above is usually the reason.
Couple of comments to answer your questions
1) You shouldn't have postgis installed in your postgres database.
2) You can install postgis in as many databases as you want 
 
 
If you are on PostgreSQL 9.1 and are running PostGIS 2.0 just run the SQL
statement
 
CREATE EXTENSION postgis;
 
in the database you want to install it in.
 
If you are in a lower database or lower PostGIS
you can create a new database and use template_postgis or template_postgis20
as your template.
 
 
Hope that helps,
Regina
http://www.postgis.us
 
 



  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Smaran
Harihar
Sent: Thursday, May 17, 2012 3:08 PM
To: PostGIS Users Discussion
Subject: [postgis-users] Unable to import shapefile using Shapefile
toPostGIS Importer


Hi I am trying to import shapefile into the Postgres database that I created
in PGAdmin3 using the Shapefile to PostGIS Importer and despite the
connection being successful I am receiving the following error, 

Connection: host=localhost port=5432 user=admin dbname=shpRepo
password='**********' 
Destination: public.AllQuebecSpecies
Source File:
/home/smaranh/development/Biodiversity/biodiversity/shapefile/AllQuebecSpeci
es
Shapefile type: Point
Postgis type: POINT[2]
Failed SQL begins: "SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "public"."AllQuebecSpecies" (gid serial PRIMARY KEY,
"family" varchar(50),
"species" varchar(50));
SELECT AddGeometryColumn('public','AllQuebecSpecies','the_geom','-1"
Failed in pgui_exec(): ERROR:  function addgeometrycolumn(unknown, unknown,
unknown, unknown, unknown, integer) does not exist
LINE 7: SELECT AddGeometryColumn('public','AllQuebecSpecies','the_ge...
               ^
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.


Shapefile import failed.

Also I am new to PostGIS and Postgres so this might sound very dumb question
but if I create a new database in pgadmin3, is it postgres database or
postgis db? If it is postgres db then probably that is why shape file is not
able to be imported since it can only be imported into PostGIS db (i think).
So how can i convert a Postgres db to PostGIS?

-- 
Thanks & Regards 
Smaran Harihar


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120517/fbbc377a/attachment.html>


More information about the postgis-users mailing list