<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1480789194883_3873">Hi,</div><div id="yui_3_16_0_ym19_1_1480789194883_4120"><br></div><div id="yui_3_16_0_ym19_1_1480789194883_4121" dir="ltr">I'm having a serious data export problem with the PGAdmin widget and pgsql2shp (QGIS too). The problem lies within converting a PostGIS table to shapefile. <b>I put in 3234 feature counts...and I get back 3221.</b><br></div><div id="yui_3_16_0_ym19_1_1480789194883_4387"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4334">I get limited information from the error reports (see below...QGIS gives me the most information...but it is minimal). The errors (when available) reference ogr....but not much else. Ironically, the only way I've found to actually export the *full* record set is by using ogr2ogr.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5328"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5399">I'm not sure why round-tripping with the PGAdmin tool is failing so bad. It seems to be able to import the initial 3234 - but cannot export the full set. <br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5398"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5397">I do notice the Polygon/Multipolygon converting happening...but seeing that many of the tables "Multipolygons" are just single Polygons added into the Multipolygon bucket...I'm not sure if that has anything to do with it.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5370"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5371">Very perplexed. If anybody can pull my dataset and repo this (or tell me how they got around it - using anything BUT ogr2ogr) I'd appreciate it!!!!<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4335"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4436">Here are my specs:</div><div id="yui_3_16_0_ym19_1_1480789194883_4202"><br></div><div id="yui_3_16_0_ym19_1_1480789194883_4205">PostgreSQL 9.2.4 (on a Linux server)<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4203">pgsql2shp 2.1.1<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4229">PostGIS 2.0 Shapefile and DBF Loader Exporter (PGAdmin tool)<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4374">QGIS 2.6.0 - Brighton (on windows...we've tested using more up-to-date versions too)</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4405"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4444">Here is the <a class="edited-link-editor" href="https://spaces.hightail.com/space/ihoE7">data</a> (2 MB unzipped on a cloud drive).</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5098"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4843">Here is what I do...</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4852"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4861">1) Load the shapefile into Postgres using the PGAdmin tool (works fine...notably it is loaded as a MULTIPOLYGON[2] EVEN THOUGH the Shapefile type is Polygon)</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5228"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5307"><b>3234 record counts</b><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5108"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5121">Importing with configuration: as_clean_test_ogr_export_utf8, public, geom, H:\as_clean_test_ogr_export_utf8.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=4326<br id="yui_3_16_0_ym19_1_1480789194883_5117">Shapefile type: Polygon<br id="yui_3_16_0_ym19_1_1480789194883_5118">PostGIS type: MULTIPOLYGON[2]<br id="yui_3_16_0_ym19_1_1480789194883_5119">Shapefile import completed.<br id="yui_3_16_0_ym19_1_1480789194883_5120">Connecting:  host=pgsqlgis-repos port=5432 user=local-dev password='*********'<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5144"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4862">2) Try to export the table tp shapefile... (this doesn't work for the following..and notably they are all trying to export it as a Polygon)<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4884"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4885">UPON Export (using >pgsql2shp)</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4893"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4892">H:\>pgsql2shp -f E:/as_clean_test_ogr_export_utf8.shp -h <hostname> -u <username> -p <port> -P <password> <postgrestable> "as_clean_test_ogr_export_utf8"<br id="yui_3_16_0_ym19_1_1480789194883_4928"><br id="yui_3_16_0_ym19_1_1480789194883_4929">Initializing...<br id="yui_3_16_0_ym19_1_1480789194883_4930">Done (postgis major version: 2).<br id="yui_3_16_0_ym19_1_1480789194883_4931">Output shape: Polygon<br id="yui_3_16_0_ym19_1_1480789194883_4932">Dumping: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<b> [3221 rows]</b>.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4936"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5020">QGIS (Save As in QGIS 2.6.0) <br id="yui_3_16_0_ym19_1_1480789194883_5003"><br id="yui_3_16_0_ym19_1_1480789194883_5004">Export to vector file failed.<br id="yui_3_16_0_ym19_1_1480789194883_5005">Error: Feature write errors:<br id="yui_3_16_0_ym19_1_1480789194883_5006">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5007">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5008">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5009">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5010">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5011">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5012">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5013">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5014">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5015">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5016">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5017">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5018">Feature geometry not imported (OGR error: )<br id="yui_3_16_0_ym19_1_1480789194883_5019"><b id="yui_3_16_0_ym19_1_1480789194883_5303">Only 3221 of 3234 features written.</b></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5022"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5200">Export Using PostGIS 2.0 Shapefile and DBF Loader Exporter<br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5199"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_4952"><b>3221 record counts</b><br id="yui_3_16_0_ym19_1_1480789194883_5283"><br id="yui_3_16_0_ym19_1_1480789194883_5284">Exporting with configuration: as_clean_test_ogr_export_utf8, public, as_clean_test_ogr_export_utf8<br id="yui_3_16_0_ym19_1_1480789194883_5285">Done (postgis major version: 2)<br id="yui_3_16_0_ym19_1_1480789194883_5286">Output shape: Polygon<br id="yui_3_16_0_ym19_1_1480789194883_5287">Table export completed.<br id="yui_3_16_0_ym19_1_1480789194883_5288"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1480789194883_5259"><br></div></div></body></html>