[postgis-users] Retrieve variables values from nested function

Mike Toews mwtoews at gmail.com
Mon Sep 23 04:36:46 PDT 2013


Collecting and dumping geometries appears to be unnecessary, if you
want to rotate the geometries and also get returned row and col
values. Try something like this:

SELECT
  ST_SetSRID(ST_Rotate(cells.geom,
    ((pi()/2) -
      (ST_Azimuth(ST_Point(498320.705, 4783932.452),
                  ST_Point(498344.646, 4783932.501)))),
    498320.705, 4783932.452), 32631) as geom,
  cells.row, cells.col
FROM
  ST_CreateFishnet(10, 20, 1.2, 0.6, 498320.705, 4783932.452) AS cells;

-Mike

On 23 September 2013 22:32, car271 <cfazio at ticonzero.net> wrote:
> Hi all,
>
> i've a function, ST_CreateFishnet, who returns 3 variables: geom, row and
> col.
>
> My goal is retrieve variables values "row" and "col" where ST_CreateFishnet
> is nested like query below:
>
> SELECT dump.geom FROM ST_Dump(ST_SetSRID(ST_Rotate((SELECT
> ST_Collect(cells.geom), cells.row, cells.col FROM ST_CreateFishnet(10, 20,
> 1.2, 0.6, 498320.705,4783932.452) AS cells), ((pi()/2) -
> (ST_Azimuth(ST_Point(498320.705,4783932.452),
> ST_Point(498344.646,4783932.501)))), 498320.705,4783932.452), 32631)) as
> dump.
>
> When i execute previous query, i get this error:
>
> column "cells.row" must appear in the GROUP BY clause or be used in an
> aggregate function.
>
> What i wrong?
>
> Regards.
>
> car271
>
>
>
> --
> View this message in context: http://postgis.17.x6.nabble.com/Retrieve-variables-values-from-nested-function-tp5004263.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list