0

I have a working SQL code that creates geometries according to numbers generated from a generate_series function:

  CREATE TEMPORARY TABLE catchments ON COMMIT DROP AS (
    SELECT lims, ST_ConcaveHull(the_geom, alpha_factor) AS the_geom_overlap FROM (
      SELECT lims, ST_MakeValid(ST_Collect(n.the_geom)) AS the_geom
      FROM generate_series(1, 10, 2) AS lims, pgr_drivingDistance(
        'SELECT id, source, target, cost, reverse_cost FROM edges',
        vertex_id, lims, true
      ) a, nodes n WHERE a.node = n.vid
      GROUP BY lims
    ) AS conv_hull
    ORDER BY lims DESC
  );

Now I need to replace the fixed interval series by an array with varying intervals, e.g. [1, 2, 5, 7, 8].

Is there a simple way to "convert" the generate_series by an array with the same logic? I would like to avoid using a for loop if possible.

1 Answer 1

1
FROM unnest(ARRAY[1,2,5,7,8]) AS lims

should do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.