<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div>Hello Everyone,</div><div id="yui_3_16_0_1_1427981938056_212384" dir="ltr">just wanted to thank you for your help. The issue was fixed and I just wanted to describe what actually was the problem.</div><div id="yui_3_16_0_1_1427981938056_209572" dir="ltr"><br></div><div id="yui_3_16_0_1_1427981938056_212385" dir="ltr">Basically, this was the issue: <br></div><pre style="" class="" id="yui_3_16_0_1_1427981938056_212403">This indeed returns one problem: The big polygon its outer shell apparently intersects at one place (which is allowed in shapefile, but not in OGC SFS geometries as implemented in PostGIS). </pre><div dir="ltr" id="yui_3_16_0_1_1427981938056_209498"><span id="yui_3_16_0_1_1427981938056_212437">So, the solution that I chose to apply was to buffer the geometries when ingesting them into PostGIS.</span></div><div id="yui_3_16_0_1_1427981938056_212455" dir="ltr"><br><span id="yui_3_16_0_1_1427981938056_212437"></span></div><div id="yui_3_16_0_1_1427981938056_212456" dir="ltr"><span id="yui_3_16_0_1_1427981938056_212437">Happy Easter!</span></div><div id="yui_3_16_0_1_1427981938056_212457" dir="ltr"><span id="yui_3_16_0_1_1427981938056_212437">Conrad</span></div><br>  <div id="yui_3_16_0_1_1427981938056_209553" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1427981938056_209552" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1427981938056_209551" dir="ltr"> <hr size="1">  <font id="yui_3_16_0_1_1427981938056_209550" face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Mark Wynter <mark@dimensionaledge.com><br> <b><span style="font-weight: bold;">To:</span></b> "postgis-users@lists.osgeo.org" <postgis-users@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, March 19, 2015 9:17 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] Problem importing SHP polygons<br> </font> </div> <div id="yui_3_16_0_1_1427981938056_209554" class="y_msg_container"><br>If Mark's suggestion doesn't fix it... <br><br>sounds like the imported geometries in PostGIS are not valid - possibly due to self intersections and on occasions polygons with zero areas that appear like linestrings - something not uncommon when converting rasters to vectors.<br><br>run some checks on your imported geometries, like<br>st_isvalid, st_area, geometrytype.<br><br>Depending on what you find, you can develop a set of cleaning steps like<br><br>St_makevalid, st_buffer(,0),<br>where geometrytype in(multi polygon,polygon) etc.<br><br><br><br>> Message: 5<br>> Date: Thu, 19 Mar 2015 09:40:07 +0000<br>> From: Mark Cave-Ayland <<a ymailto="mailto:mark.cave-ayland@ilande.co.uk" href="mailto:mark.cave-ayland@ilande.co.uk">mark.cave-ayland@ilande.co.uk</a>><br>> To: Conrad Bielski <<a ymailto="mailto:conrad_bielski@yahoo.com" href="mailto:conrad_bielski@yahoo.com">conrad_bielski@yahoo.com</a>>,    PostGIS Users<br>>    Discussion <<a ymailto="mailto:postgis-users@lists.osgeo.org" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>><br>> Subject: Re: [postgis-users] Problem importing SHP polygons<br>> Message-ID: <<a ymailto="mailto:550A9977.3000400@ilande.co.uk" href="mailto:550A9977.3000400@ilande.co.uk">550A9977.3000400@ilande.co.uk</a>><br>> Content-Type: text/plain; charset=windows-1252<br>> <br>>> On 10/03/15 14:48, Conrad Bielski wrote:<br>>> <br>>> Hi,<br>>> I'm having a curious issue importing a polygon SHP file into PostGIS.<br>>> I'll describe the procedure that I'm using and the problem that I'm<br>>> having and hopefully somebody has had this issue in the past and fixed it.<br>>> <br>>> So the procedure is that I use GRASS to produce a vector from a raster<br>>> output: (r.to.vect input=MASK output=vecMap feature=area)  and then<br>>> export to SHP file (v.out.ogr -c -e input=vecMap dsn=fname<br>>> format=ESRI_Shapefile type=area).<br>>> <br>>> Now when this SHP file is imported into PostGIS, the type is changed to<br>>> multistring for some reason. Then when checking the topology, there is a<br>>> 'ring self-intersection' error. This PostGIS db is then imported into<br>>> GeoServer, where lines are connecting between different parts of the<br>>> largest polygon (this should not be happening). If I fix this typology<br>>> problem, then the largest polygon in the db disappears.<br>>> <br>>> The strange thing is the following:<br>>> 1. Opening the SHP file in QGIS doesn't have this problem<br>>> 2. Importing the SHP file directly into GeoServer, doesn't generate this<br>>> problem either.<br>>> <br>>> Why is PostGIS having an issue importing this file?<br>>> <br>>> Any ideas how to fix this?<br>>> <br>>> Thanks in advance for your help,<br>>> Conrad<br>> <br>> Hi Conrad,<br>> <br>> Have you tried disabling the MULTI conversion code in shp2pgsql (add -S<br>> option to the command line) to see if that helps<br>_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@lists.osgeo.org" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br><br><br></div> </div> </div>  </div></body></html>