perfect! and yes, i forgot the dbase name.<br><br>On Tuesday, 20 November 2012 12:21:23 UTC, Nicolas Ribot  wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi, <div>Enclose the query string in double quotes:</div><div>pgsql2shp -f file.shp database "select * from ..."</div><div><br></div><div>Didn't you forget to add the database name in your command ?</div><div>
<br></div><div>Nicolas</div><div><br><br><div class="gmail_quote">On 20 November 2012 11:37, perikut <span dir="ltr"><<a href="javascript:" target="_blank" gdf-obfuscated-mailto="qn2ehfLMJ5MJ">per...@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>hello, i am trying to make not a usual postgis to shapefile dump, as the geometry is created on the fly along with other calculations.</div>
<div><br></div><div>this Sql works fine, as you can see i create the geom on the fly  </div><div><br></div><div>select SUM(counter) as suma, astext(snapped_geom) as centroid, geomfromText(ST_AsText(ST_<wbr>Envelope(GEOMETRYFROMTEXT('<wbr>LINESTRING('||(st_xmax(<wbr>snapped_geom)-2.5||' '||(st_ymax(snapped_geom)-2.5)<wbr>||', '||(st_xmax(snapped_geom)+2.5)<wbr>||' '||(st_ymax(snapped_geom)+2.5)<wbr>||')'),4326)))) as pols from ( SELECT (regexp_matches(t::text, E'(Anguilla[\+])([0-9]+)'::<wbr>text)::text[])[2]::integer as counter,snapped_geom from (select ST_SnapToGrid( ST_SetSRID(the_geom, 4326), 5) as snapped_geom,array_genus from simple_datapublisher_3 where array_genus ~ 'Anguilla'::text group by snapped_geom,array_genus) t ) t2 GROUP BY snapped_geom;</div>
<div><br></div><div>but when i directly put on a pgsql2shp operation, i get error like... Syntax error near to unexpected symbol « ( »</div><div><br></div><div>pgsql2shp -f /www/test -p 5432 -h host -u user -P pwd -g polygons select SUM(counter) as suma, astext(snapped_geom) as centroid, geomfromText(ST_AsText(ST_<wbr>Envelope(GEOMETRYFROMTEXT('<wbr>LINESTRING('||(st_xmax(<wbr>snapped_geom)-2.5||' '||(st_ymax(snapped_geom)-2.5)<wbr>||', '||(st_xmax(snapped_geom)+2.5)<wbr>||' '||(st_ymax(snapped_geom)+2.5)<wbr>||')'),4326)))) as polygons from ( SELECT (regexp_matches(t::text, E'(Anguilla[\+])([0-9]+)'::<wbr>text)::text[])[2]::integer as counter,snapped_geom from (select ST_SnapToGrid( ST_SetSRID(the_geom, 4326), 5) as snapped_geom,array_genus from simple_datapublisher_3 where array_genus ~ 'Anguilla'::text group by snapped_geom,array_genus) t ) t2 GROUP BY snapped_geom;</div>
<div><br></div><div>I am not sure if paremeter -g (set as polygons because the resulting geometries are named polygons) is correctly set, but even removing it i allways get the same error.</div><div><br></div><div>I know the SQL sentence is a little complicated, just below a very basic structure to get an idea what is doing.</div>
<div><br></div><div>geom1, Anguilla +30||specieY+<wbr>10||specieZ+5</div><div>geom2, specieX+10|| Anguilla +10</div><div>...</div><div><br></div><div>thanks in advance,</div><div><br></div><div>Pere Roca</div><div><br></div><div>
<br></div><br>______________________________<wbr>_________________<br>
postgis-users mailing list<br>
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="qn2ehfLMJ5MJ">postgi...@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<wbr>bin/mailman/listinfo/postgis-<wbr>users</a><br>
<br></blockquote></div><br></div>
</blockquote>