[postgis-users] Changing transaction behaviour in shp2pgsql

pcreso at pcreso.com pcreso at pcreso.com
Sun Mar 14 10:39:16 PDT 2010


Hi Ben

You might remove the begin & commit commands via your command line with sed, or see if ogr2ogr gives you a more robust conversion.


For the first, something like:

shp2pgsql -s 28350 -W UTF8 \
/Users/owner/Spatial/country/AUS/WA/MRWA/mrwa_network.shp \
gis.mrwa_gda94 | sed 's/BEGIN//' | sed 's/COMMIT//' psql australia

If this fails, or you want to try ogr2ogr, ask again :-)

Cheers,

  Brent 


--- On Sun, 3/14/10, Ben Madin <lists at remoteinformation.com.au> wrote:

> From: Ben Madin <lists at remoteinformation.com.au>
> Subject: [postgis-users] Changing transaction behaviour in shp2pgsql
> To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Date: Sunday, March 14, 2010, 10:58 PM
> 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