I'm really struggling with optimizing one of my sources. Instead of doing all the request and foreach loops in my server side application. I am thinking about shifting it fully to the database side. But I am struggling!
SELECT ST_asText( ST_ConcaveHull(ST_Collect(the_geom), 0.95)) FROM ways JOIN (SELECT seq, id1 AS node, cost FROM pgr_drivingDistance( 'SELECT gid as id, source, target, reverse_cost as cost FROM ways', pgr_pointtoid(ST_setSRID(ST_MakePoint(7.26, 46.57),4326), 0.01)::Integer , 10, false, false)) as dd_route ON ways.gid = dd_route.node;
But now I would like to replace the static point with a list or an array, and I just can't figure out how. I know there are a few cracks in PostgreSQL on this site.
We could use the following query to gather the data:
SELECT ST_SetSRID(ST_MakePoint(tmp::double precision, tmp::double precision), 4326) FROM ( SELECT string_to_array(unnest(content), ',') as tmp FROM ( SELECT string_to_array('7.26,46.57/8.26,46.25', '/') as content ) as data_array ) as data_row
The idea is now to the static set ST_MakePoint statement with a 'kind of foreach' statement.