[postgis-users] Changing transaction behaviour in shp2pgsql

Stephen Woodbridge woodbri at swoodbridge.com
Sun Mar 14 09:21:28 PDT 2010


Ben,

You can probably just strip the BEGIN and COMMIT lines like

shp2pgsql ... | grep -v BEGIN | grep -v COMMIT | psql australia

You might also want to look at the file:

shp2pgsql ... > data.sql
vi data.sql

HTH,
   -Steve

Ben Madin wrote:
> G'day all,
> 
> I'm using shp2pgsql to import a road network, of which the fine detail is not so important. 
> 
> Mac OS X 10.6.2  POSTGIS="1.4.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23 September 2009" USE_STATS (thanks William K)
> 
> 
> $ shp2pgsql -s 28350 /Users/owner/Spatial/country/AUS/WA/MRWA/mrwa_network.shp gis.mrwa_gda94 | psql australia
> 
> During the import a number of times (4) I get the 
> 
> 	ERROR:  invalid byte sequence for encoding "UTF8": 0xec5343
> 	HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by 	"client_encoding".
> 	ERROR:  current transaction is aborted, commands ignored until end of transaction block
> 
> and the next several hundred records are skipped.
> 
> When I put the -W UTF8 flag in , I miss the errors but die when I get to about 101000 (out of 150000) records in :
> 
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> ERROR:  syntax error at end of input
> LINE 1: ...e_geom) VALUES ('1.15574000000e+005','GILMORE ST (SCADDAN)',
> 
> 
> in the event I can't work out the encoding, is there any way to turn off the transaction behaviour, ie I'm happy to miss 4 records, but not 1000 as a result of the transactions being aborted. (short of putting it all into a text file and removing all the begin and commit commands...)
> 
> cheers
> 
> Ben
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 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