[postgis-users] Large WKT from file
yvecai
yvecai at gmail.com
Mon Feb 20 13:59:55 PST 2012
Thanks Josh, but I'd like to avoid digging into the source, it must be
another way.
I come out to something like that, but I can't figure out how to use my
wkt() as a value for ST_geometryfromwkt() ??
CREATE TEMP TABLE x (x text);
COPY x from '/home/website/SRTM/contours-extracts/france.wkt';
create function wkt() returns text as $$
begin
return (SELECT x from x);
end;
$$ LANGUAGE plpgsql;
SELECT
ST_simplify(intersection(way,ST_GeomFromWKT((wkt(),-1)),0.00005),
height
from contours where ST_Intersects(way, ST_GeomFromWKT(wkt(),-1));
Yves
Le 20/02/2012 21:24, yvecai a écrit :
> Hi all,
> It's maybe more a bash question than a Postgis one, but ...
>
> I'm extracting shapefiles from a SRTM contour lines postgis base,
> using WKT multipolygons to cut extract by country.
> This gives something like:
>
> pgsql2shp -f shp/my_shapefile.shp -u mapnik contour \
> "SELECT
> ST_simplify(intersection(way,GeomFromText('$poly',-1)),0.00005),
> height \
> from contours where \
> ST_Intersects(way, GeomFromText('$poly',-1));"
>
> where $poly is a large WKT (like this one:
> http://pistes-nordiques.org/download/france.wkt).
>
> I have the following error: /usr/bin/pgsql2shp: Argument list too long
>
> I played a little with xargs, but with no success. Is there a way to
> load the wkt from a file with postgres, or something else?
>
> yves
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120220/bb41ee71/attachment.html>
More information about the postgis-users
mailing list