[postgis-users] IF, ELSE, FOR and WHILE in postgis
Maxime van Noppen
maxime at altribe.org
Mon Oct 12 08:24:02 PDT 2009
Daniel Grum wrote:
> The SQL-Skript:
> UPDATE einheiten_und_bewegungen
> SET the_geom = (SELECT
> ST_Line_SubString(ST_LineMerge(line.the_geom),(1-((Length(line.the_geom)-1000)
>
> /Length(line.the_geom))),1)
> FROM public.einheiten_und_bewegungen line
> WHERE length(line.the_geom)>1000
> ORDER BY line.gid);
>
> In the table einheiten_und_bewegungen are more than one line!
Hi,
It seems that the problem of your query is that the SELECT query might
return more than a row. I thinked what you wanted to write is something
more like :
> UPDATE einheiten_und_bewegungen
> SET the_geom = ST_Line_SubString(ST_LineMerge(the_geom),(1-((Length(the_geom)-1000)/Length(the_geom))),1)
> WHERE length(the_geom)>1000;
I don't see why the select is necessary. This UPDATE query will update
any row where the length of the_geom is >1000 with the formula you provided.
--
Maxime
More information about the postgis-users
mailing list