Skip to content

Commit ce6ae45

Browse files
committed
Add notes about cleaning out middle tables. Remove SQL script, the docs are better than that draft file.
1 parent 7d42672 commit ce6ae45

File tree

2 files changed

+18
-253
lines changed

2 files changed

+18
-253
lines changed

docs/src/routing-4.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
55
## Pre-process the OpenStreetMap Roads
66

7-
8-
## Clean the data
9-
10-
The following query converts multi-linestring data to multiple rows of
11-
`LINESTRING` records required by `pgRouting`.
12-
7+
The following query converts `ST_MultiLineString` data to individual rows of
8+
`LINESTRING` records.
139

1410
```sql
1511
CREATE TABLE routing.osm_road_intermediate AS
@@ -68,18 +64,17 @@ CREATE INDEX ix_routing_road_line_osm_id
6864
```
6965

7066

71-
7267
## Split Long Segments
7368

7469
Use the `pgr_separateTouching()` function to split line segments into smaller
7570
segments and persist into a table.
7671
This is necessary because pgRouting can only route through the ends
7772
of line segments. It cannot switch from Line A to Line B from a point in the middle.
7873

79-
> FIXME: Make this a temp table instead?? It is not needed post-processing.
8074

8175
> Warning: This is an expensive query that does not parallelize in Postgres. The
82-
> Washington D.C. example (34k rows) takes roughly an hour (55 minutes) to run.
76+
> Washington D.C. example (34k rows) takes roughly an hour (55 minutes) to run
77+
> in Docker on my laptop.
8378
8479
```sql
8580
DROP TABLE IF EXISTS routing.road_separate_touching;
@@ -242,6 +237,9 @@ Use the `start_id` and `end_id` values from this query
242237
in subsequent queries through the `:start_id` and `:end_id` variables
243238
via DBeaver.
244239

240+
> This query simulates a GUI allowing user to click on start/end points on a map,
241+
> resulting in longitude and latitude values.
242+
245243

246244
```sql
247245
WITH s_point AS (
@@ -466,3 +464,14 @@ SELECT d.*, n.geom AS node_geom, e.geom AS edge_geom
466464
![Screenshot from DBeaver showing the route generated with all roads and limiting based on route_motor and using the improved cost model including forward and reverse costs. The route bypasses the road(s) marked access=no and access=private, as well as respects the one-way access controls.](dc-example-route-start-motor-access-control-oneway.png)
467465

468466

467+
468+
## Cleanup Intermediary tables
469+
470+
There are 2 tables used to build the routing network that are not needed
471+
after the `routing.osm_road_edge` and `routing.osm_road_vertex` tables are
472+
populated.
473+
474+
```sql
475+
DROP TABLE IF EXISTS routing.osm_road_intermediate;
476+
DROP TABLE IF EXISTS routing.road_separate_touching;
477+
```

docs/src/static/pgrouting-4-examples-initial-draft.sql

Lines changed: 0 additions & 244 deletions
This file was deleted.

0 commit comments

Comments
 (0)