[postgis-users] shp2pgsql problem with very large .shp-files

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Wed Aug 15 15:08:03 PDT 2007


On Wed, 2007-08-15 at 09:51 +0200, Stefan Zweig wrote:
> hi list,
> 
> i have a problem with the shp2pgsql program:
> 
> this command:
> /usr/local/pgsql/bin/shp2pgsql -s 4326 -c -I -D -k /var/gisapp/postgreexport/_G342.shp public._g342 > /var/gisapp/postgreexport/_g342.sql
> works alright, no problems at all
> 
> whereas this command:
> /usr/local/pgsql/bin/shp2pgsql -s 4326 -c -I -D -k /var/gisapp/postgreexport/_G2681.shp public._g2681 > /var/gisapp/postgreexport/_g2681.sql
> causes shp2pgsql to answer:
> 
> "/var/gisapp/postgreexport/_G2681.shp: shape (.shp) or index files (.shx) can not be opened."
> 
> ls -la in /var/gisapp/postgreexport/ says the following:
> 
> -rwxrwxrwx  1 root     root    171848556 2007-08-14 18:38 _G2681.dbf
> -rwxrwxrwx  1 root     root                143 2007-08-14 18:38 _G2681.prj
> -rwxrwxrwx  1 root     root  4565523268 2007-08-14 18:38 _G2681.shp
> -rwxrwxrwx  1 root     root    124980820 2007-08-14 18:38 _G2681.shx
> -rwxrwxrwx  1 root     root                308 2007-08-15 09:35 _G342.dbf
> -rwxrwxrwx  1 root     root                143 2007-08-15 09:35 _G342.prj
> -rwxrwxrwx  1 root     root                716 2007-08-15 09:35 _G342.shp
> -rwxrwxrwx  1 root     root                276 2007-08-15 09:35 _G342.shx
> 
> 
> so the only difference between shp-file _g2681 and shp-file _g342 is that _g2681 is an extremely big one. (and actually there is another difference: _G342.shp is a point shape, _g2681.shp is a line shape)
> 
> any ideas?
> 
> i appreciate any help, thanks in advance,
> 
> stefan


Hi Stefan,

I'm not 100% sure, but I suspect that this is because your shapefile is
> 2GB and shp2pgsql doesn't have large file support :(

If you are on a UNIX OS, you could try recompiling shp2pgsql with the
-D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 flags to see if that
allows you to work with the larger files.


ATB,

Mark.

-- 
ILande - Open Source Consultancy
http://www.ilande.co.uk





More information about the postgis-users mailing list