<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV>Thanks Helen,</DIV>
<DIV>I've been trying to make it work. I don't have ogr2ogr.exe somewhere in PostgreSQL folder. The only place where I have ogr2ogr.exe is in FWTools folder, (other ones in OSGeo4W do not work, dll problems).</DIV>
<DIV>So I try this:</DIV>
<DIV> </DIV>
<DIV>C:\Program Files\FWTools2.4.7\bin> ogr2ogr -a srs EPSG:27700 -f "ESRI Shapefile" file.shp PG:"dbname=postgis host=localhost user=postgres password=postgres" -sql "SELECT AsBinary(the_geom) as wkb_geometry FROM W_TQ2575_Buffer"</DIV>
<DIV>After this I do not get any error message, but I get the ogr2ogr usage information (as if something I typed is wrong) and the file.shp is not created (cannot be found anywhere).</DIV>
<DIV>Any help?<BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 13px"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Helen San Segundo Navazo <hsansegundo@meteo.cat><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> PostGIS Users Discussion <postgis-users@postgis.refractions.net><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wed, November 17, 2010 9:29:15 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [postgis-users] export polygon to shapefile problem<BR></FONT><BR>Hi Thomas,<BR><BR>I use the next expression to export data automatically in an script from a table with polygons into a shape file:<BR><BR><BR>ogr2ogr -a_srs EPSG:23031 -f "ESRI Shapefile" file.shp PG:"dbname=db_name host=the_host user=the_user password=the_password" -sql "SELECT AsBinary(the_geometry_column) as wkb_geometry, column2,column3,column4 etc. FROM table where conditions"<BR><BR>I hope this will help you,<BR>Helen<BR><BR><BR>Thomas Kouk escribió:<BR>> <BR>> Hi all,<BR>> <BR>> 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:<BR>> <BR>> pgsql2shp -P [password] -f [shapefile path & name] postgis [tablename], for example: pgsql2shp -P postgres -f Data\Buffers\ Buffer.shp postgis buffer_table<BR>> <BR>> 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:<BR>> <BR>> / Initializing... Done (postgis major version: 1)./<BR>> <BR>> / Output shape: Polygon/<BR>> <BR>> / Dumping: XX [1 rows]./<BR>> <BR>> 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).<BR>> <BR>> 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.<BR>> <BR>> 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.<BR>> <BR>> Has anyone come to this problem or is there something I do not know about exporting polygon tables to shp?<BR>> <BR>> Thanks.<BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> postgis-users mailing list<BR>> <A href="mailto:postgis-users@postgis.refractions.net" ymailto="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR>> <A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>> <BR><BR><BR>-- <BR>Helen San Segundo Navazo<BR><BR><BR><A href="http://www.meteo.cat/" target=_blank>http://www.meteo.cat</A><BR>Tel. 93 567 60 90<BR>Fax 93 567 61 02<BR>A/e <A href="mailto:hsansegundo@meteo.cat" ymailto="mailto:hsansegundo@meteo.cat">hsansegundo@meteo.cat</A> <mailto:<A href="mailto:hsansegundo@meteo.cat" ymailto="mailto:hsansegundo@meteo.cat">hsansegundo@meteo.cat</A>><BR><BR>Abans d’imprimir aquest correu, assegureu-vos que és del tot necessari. El medi ambient és cosa de tothom!<BR><BR>La informació d'aquesta transmissió electrònica és confidencial i el seu ús sols està permès als seus destinataris. Si Vostè no és la persona destinatària d'aquesta transmissió electrònica, li preguem que ens ho comuniqui de forma immediata i destrueixi qualsevol copia
de la mateixa (tant digital com en paper).<BR><BR>_______________________________________________<BR>postgis-users mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net" ymailto="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></DIV></DIV></div><br></body></html>