<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>Hi all,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>I am newbie in PostGIS and I have a problem exporting a polygon table in shp. I want to export specific spatial tables from by database using a batch procedure (bat file). The command I use is:<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>pgsql2shp -P [password] -f [shapefile path & name] postgis [tablename], for example: pgsql2shp -P postgres -f Data\Buffers\ Buffer.shp postgis buffer_table<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>It works fine with all other spatial tables (linestring or multilinestring type). For polygons it also seems to work, as I get no error message:<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><I style="mso-bidi-font-style: normal"><FONT face=Calibri>    Initializing... Done (postgis major version: 1).<o:p></o:p></FONT></I></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><I style="mso-bidi-font-style: normal"><FONT face=Calibri>    Output shape: Polygon<o:p></o:p></FONT></I></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><I style="mso-bidi-font-style: normal"><FONT face=Calibri>    Dumping: XX [1 rows].<o:p></o:p></FONT></I></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>However, when I try to load the polygon shp in Qgis or ArcGIS I get an error: ArcGIS cannot open the file, while QGIS loads the shp but displays nothing (as if the table is empty, which is not the case).<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>All my tables are spatial tables with no information on geometry_columns table, but even if I add the polygon table in the geometry_columns, nothing changes. After all, the function works with all other spatial non polygon tables despite the fact that geometry_columns holds no information on them, so this is not the problem.<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>I can load the postgis polygon table in qgis and export it manually to a shp, which works fine, but I need to do it in an automatic way using a command.<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>Has anyone come to this problem or is there something I do not know about exporting polygon tables to shp?<o:p></o:p></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT face=Calibri>Thanks.<o:p></o:p></FONT></P></DIV></div><br></body></html>