[postgis-users] pgsql2shp output truncated - work around

Ben Madin ben at ausvet.com.au
Wed Dec 18 22:31:36 PST 2013


G’day again,

for lack of better solution I’ve found that ogr2ogr is working better - or at least in it is returning all the rows:

 ogr2ogr -f 'ESRI Shapefile' ${DIRPATH}${YEAR}/${MAPTYPE}bnda${YEAR}.shp PG:'host=localhost user=ben dbname=maps password=whatever’

interestingly, it also appears to be working a little faster

cheers

Ben




On 2013-12-17, at 15:46 , Ben Madin <ben at ausvet.com.au> wrote:

> G’day all,
> 
> I’ve been using pgsql2shp to create shape files for a client by creating a table which contains global level 1 administrative boundaries (3670 records). When I connect to the db, I can see this many records and display the appropriate geometries. 
> 
> select ccode, admin1, mapcode, st_mem_size(geom), st_isvalidreason(geom) from polbnda2013 where ccode like 'ZWE' ORDER BY 1,2;
>  ccode |       admin1        | mapcode | st_mem_size | st_isvalidreason 
> -------+---------------------+---------+-------------+------------------
>  ZWE   | BULAWAYO            |    3230 |        2496 | Valid Geometry
>  ZWE   | HARARE              |    3231 |        3264 | Valid Geometry
>  ZWE   | MANICALAND          |    3232 |      108992 | Valid Geometry
>  ZWE   | MASHONALAND CENTRAL |    3233 |       63616 | Valid Geometry
>  ZWE   | MASHONALAND EAST    |    3234 |       34080 | Valid Geometry
>  ZWE   | MASHONALAND WEST    |    3235 |       24432 | Valid Geometry
>  ZWE   | MASVINGO            |    3236 |       29840 | Valid Geometry
>  ZWE   | MATABELELAND NORTH  |    3237 |       28832 | Valid Geometry
>  ZWE   | MATABELELAND SOUTH  |    3238 |       69792 | Valid Geometry
>  ZWE   | MIDLANDS            |    3239 |       31296 | Valid Geometry
> (10 rows)
> 
> 
> When I run 
> 
> pgsql2shp -b -p 5432 -f outputs/2013/polbnda2013 -g geom -u ben -P noway oiemaps outputs.polbnda2013 
> Initializing... 
> Done (postgis major version: 2).
> Output shape: Polygon
> Dumping: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [3665 rows].
> 
> 
> The five rows missing are the last five rows in the table (Zimbabwe…). 
> 
> Ahh you say - an error in the data for Zimbabwe! But, if I just export Zimbabwe :
> 
> pgsql2shp -b -r -p 5432 -f outputs/2013/polbnda2013 -g geom -u ben -P caitlin oiemaps "SELECT * FROM polbnda2013 WHERE ccode LIKE 'ZWE' ORDER BY ccode, admin1"
> Initializing... 
> Done (postgis major version: 2).
> Output shape: Polygon
> Dumping: X [10 rows].
> 
> 
> Due to the resolution I’m looking at about a 130MB output file, so I won’t email it in here, but the batch processing is being done on an AWS EC2 server running Ubuntu 12.04LTS (This is the third server I have tried running it on)
> 
>  PostgreSQL 9.3.2 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
>  POSTGIS="2.1.0 r11822" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER
> 
> 
> Has anyone seen anything similar, any ideas where I can start. 
> 
> cheers
> 
> Ben
> 
> 
> 
> 
> -- 
> 
> Ben Madin
> 
> t : +61 8 6102 5535
> m : +61 448 887 220
> e : ben at ausvet.com.au
> 
> AusVet Animal Health Services
> Western Australia
> 
> AusVet's website:  http://www.ausvet.com.au
> 
> This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this email are the opinion of the writer only and are not endorsed by AusVet Animal Health Services unless expressly stated otherwise. Although AusVet uses virus scanning software we do not accept liability for viruses or similar in any attachments. Thanks for reading.
> 


-- 

Ben Madin

t : +61 8 6102 5535
m : +61 448 887 220
e : ben at ausvet.com.au

AusVet Animal Health Services
Western Australia

AusVet's website:  http://www.ausvet.com.au

This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this email are the opinion of the writer only and are not endorsed by AusVet Animal Health Services unless expressly stated otherwise. Although AusVet uses virus scanning software we do not accept liability for viruses or similar in any attachments. Thanks for reading.



More information about the postgis-users mailing list