<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
try<br>
C:\Program Files\FWTools2.4.7\bin>ogr2ogr -a srs "EPSG:27700" ...<br>
<br>
Does your sql-statemnet produce a result when executed within psql?<br>
Are you sure there's no error message right above the usage information?<br>
Do you want to reproject to 27700? Then you should use -t_srs<br>
<br>
Marco<br>
<br>
Am 17.11.2010 12:56, schrieb Thomas Kouk:
<blockquote cite="mid:835204.59892.qm@web27805.mail.ukl.yahoo.com"
 type="cite">
  <style type="text/css"><!-- DIV {margin:0px;} --></style>
  <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 <a class="moz-txt-link-rfc2396E" href="mailto:hsansegundo@meteo.cat"><hsansegundo@meteo.cat></a><br>
  <b><span style="font-weight: bold;">To:</span></b> PostGIS Users
Discussion <a class="moz-txt-link-rfc2396E" href="mailto:postgis-users@postgis.refractions.net"><postgis-users@postgis.refractions.net></a><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 moz-do-not-send="true"
 href="mailto:postgis-users@postgis.refractions.net"
 ymailto="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a moz-do-not-send="true"
 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 moz-do-not-send="true" 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 moz-do-not-send="true" href="mailto:hsansegundo@meteo.cat"
 ymailto="mailto:hsansegundo@meteo.cat">hsansegundo@meteo.cat</a>
<mailto:<a moz-do-not-send="true" 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 moz-do-not-send="true"
 href="mailto:postgis-users@postgis.refractions.net"
 ymailto="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
  <a moz-do-not-send="true"
 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>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>