[postgis-users] Encoding Issues shp2pgsql

TECHER David davidtecher at yahoo.fr
Mon Apr 16 11:10:39 PDT 2007


Hi Travis

For WGS84, please use shp2pgsql with option -s for the srid=4326

shp2pgsql -s 4326 -DI yourshapefile yourtable | psql -U user -h host 
database

Then your data will be encoded correctly. For example, here I am using 
the funtion astext(...)

routing=# select  
astext('010600000001000000010300000001000000060000006C09ABED6BD153C0B
6A94C7F66EB4540D27B711A65D153C03DB93F9D64EB454029C8F14C65D153
C0BFBCFE0462EB4540F257E2276CD153C06323D18263EB454055AB83F46BD15
3C0BE0F072566EB45406C09ABED6BD153C0B6A94C7F66EB4540'::geometry);
                                                                                                               
astext
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 MULTIPOLYGON(((-79.2722124262124 43.8390654682475,-79.2717958553542 
43.8390080033446,-79.2718078957702 43.8389288181147,-79.2722263059984 
43.8389743348296,-79.2722140584786 43.8390547070007,-79.2722124262124 
43.8390654682475)))
(1 ligne)

So you can try the srid() fonction to see if it is good ;). You should 
get 4326



Travis Kirstine a écrit :
> Hi All,
> I have been trying to add a shpfile to postgis using the shp2pgsql
> utility program, with little success.  The attribute info seems to be
> fine however the coords of the_geom field are encoded incorrectly.
> The source shpfile is in WGS84 geographic projection and I am running
> the postgis on linux.  Any Ideas?
>
> The .sql file:
>
> BEGIN;
> CREATE TABLE "lro_65_owner_parcel" (gid serial PRIMARY KEY,
> "pin" varchar(9));
> SELECT 
> AddGeometryColumn('','lro_65_owner_parcel','the_geom','-1','MULTIPOLYGON',2); 
>
> INSERT INTO "lro_65_owner_parcel" ("pin",the_geom) VALUES
> ('029440218','010600000001000000010300000001000000060000006C09ABED6BD153C0B6 
>
> A94C7F66EB4540D27B711A65D153C03DB93F9D64EB454029C8F14C65D153C0BFBCFE
> 0462EB4540F257E2276CD153C06323D18263EB454055AB83F46BD153C0BE0F072566EB
> 45406C09ABED6BD153C0B6A94C7F66EB4540');
>
>


	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com



More information about the postgis-users mailing list