I need to create a series of street networks for a neighbourhood in a city. I have used PGRouting before using a whole table to create a topology but I have not been able to do so with only a subset, as you'll see here.
I'm using the following query.
WITH vkk AS (SELECT name, way FROM planet_osm_polygon WHERE admin_level = '10' AND name = 'Vallcarca i els Penitents'), roads as (SELECT r.osm_id, r.way FROM planet_osm_line r JOIN vkk v ON ST_Contains(v.way, r.way) WHERE highway IS NOT NULL) SELECT pgr_createTopology('roads', 5, 'way', 'osm_id', 'source', 'target', rows_where := 'true')
This returns the following error
NOTICE: PROCESSING: NOTICE: pgr_createTopology('roads', 5, 'way', 'osm_id', 'source', 'target', rows_where := 'true', clean := f) NOTICE: Performing checks, please wait ..... NOTICE: ----> PGR ERROR in pgr_createTopology: Table roads not found HINT: ----> Check your table name NOTICE: Unexpected error raise_exception Successfully run. Total query runtime: 47 msec. 1 rows affected.
Is there any solution besides creating a table for each neighbourhood I need to do this and then delete it? (I'd loop through the queries using sqlalchemy or something of the sort)