Skip to main content
edited body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    narr.time::FLOAT,
    false
  ) AS dd
;

or run against the actual table:

SELECT
  n.*,
  dd.*
FROM
  network AS n
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arrn.time::FLOAT,
    false
  ) AS dd
WHERE
  <filter>
;

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    n.time::FLOAT,
    false
  ) AS dd
;

or run against the actual table:

SELECT
  n.*,
  dd.*
FROM
  network AS n
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
WHERE
  <filter>
;

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
;

or run against the actual table:

SELECT
  n.*,
  dd.*
FROM
  network AS n
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    n.time::FLOAT,
    false
  ) AS dd
WHERE
  <filter>
;

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

added 320 characters in body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    n.time::FLOAT,
    false
  ) AS dd
;

or run against the actual table:

SELECT
  n.*,
  dd.*
FROM
  network AS n
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
WHERE
  <filter>
; 

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
;

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    n.time::FLOAT,
    false
  ) AS dd
;

or run against the actual table:

SELECT
  n.*,
  dd.*
FROM
  network AS n
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
WHERE
  <filter>
; 

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.

Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Process your time array sequentially:

SELECT
  arr.time_id,
  dd.*
FROM
  UNNEST(
    ARRAY(SELECT network.time FROM network LIMIT 1)
  ) WITH ORDINALITY arr(time, time_id)
  CROSS JOIN LATERAL
  pgr_drivingDistance(
    'SELECT id, source, target, cost, time FROM network', 
    ARRAY(SELECT node_id FROM isochrone_origins), 
    arr.time::FLOAT,
    false
  ) AS dd
;

Note: time is a reserved word (TIME type) in PostgreSQL and shouldn't be used as identifier!

How to handle that inside the QGIS Model Designer I don't know, but doesn't seem too far off the original attempt.