[postgis-users] Importing shapefiles with srid != -1

Obe, Regina robe.dnd at cityofboston.gov
Fri May 9 05:51:33 PDT 2008


 
James,

If you do a combined create table (and append) do you get the same error
- might also help to create an intermediate file so 
you can inspect it for strange stuff.  - e.g.

shp2pgsql -s 4326 -g gisdata provinces.shp prov2 > prov2.sql

psql psql -h myserver -d mydb -U myuser -f prov2.sql

What OS are you running?
Which version of shp2pgsql (which you can see at the top of the screen
by calling shp2pgsql without args), 
postgis version?  which you get by doing a SELECT
postgis_full_version();

Hope that helps,
Regina

> 
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> James Dominy
> Sent: Friday, May 09, 2008 8:01 AM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Importing shapefiles with srid != -1
> 
> Hi all,
> 
> I have a shape file with an associated prj. The prj file says the
shape
> file is 
> in WGS84, so I'm using
> 
> shp2pgsql -a -g gisdata -s 4326 provinces.shp GISProvinces
> 
> 
> 
> When I run the result through psql, I get
> 
> ERROR: new row for relation "gisprovinces" violates check constraint 
> "enforce_srid_gisdata"
> 
> 
> 
> The table definition is as follows...
> 
> CREATE TABLE GISProvinces (
>          region_id SERIAL PRIMARY KEY,
>          name VARCHAR(255) NULL,
>          layer INTEGER NOT NULL REFERENCES TGISLayer
> );
> SELECT AddGeometryColumn('', 'gisprovinces', 'gisdata', 4326,
> 'MULTIPOLYGON', 2);
> 
> Everything works fine if I don't specify any srid. As soon as I
specify
> an SRID 
> for either the column or the inserts (via -s with shp2pgsql), or both,
> even if 
> they are the same, I get the error. What am I doing wrong?
> 
> Thanks,
> James
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> -----------------------------------------
> The substance of this message, including any attachments, may be
> confidential, legally privileged and/or exempt from disclosure
> pursuant to Massachusetts law. It is intended
> solely for the addressee. If you received this in error, please
> contact the sender and delete the material from any computer.
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list