-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added triggers to update generalized routes which for some reason bea…
…k during the time
- Loading branch information
Showing
2 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
-- There seems to be a bug in imposm3. Simple workaround is to run this regulary, but for better one create a trigger. | ||
-- https://github.com/omniscale/imposm3/issues/293 | ||
INSERT INTO | ||
osm_route_members_gen1 (osm_id, member, role, type, geometry) | ||
SELECT | ||
osm.osm_id, | ||
osm.member, | ||
osm.role, | ||
osm.type, | ||
ST_SimplifyPreserveTopology(osm.geometry, 50) AS geometry | ||
FROM | ||
osm_route_members osm | ||
WHERE | ||
NOT EXISTS ( | ||
SELECT | ||
1 | ||
FROM | ||
osm_route_members_gen1 osm_gen1 | ||
WHERE | ||
osm_gen1.osm_id = osm.osm_id | ||
AND osm_gen1.type = osm.type | ||
); | ||
|
||
INSERT INTO | ||
osm_route_members_gen0 (osm_id, member, role, type, geometry) | ||
SELECT | ||
osm.osm_id, | ||
osm.member, | ||
osm.role, | ||
osm.type, | ||
ST_SimplifyPreserveTopology(osm.geometry, 200) AS geometry | ||
FROM | ||
osm_route_members osm | ||
WHERE | ||
NOT EXISTS ( | ||
SELECT | ||
1 | ||
FROM | ||
osm_route_members_gen0 osm_gen0 | ||
WHERE | ||
osm_gen0.osm_id = osm.osm_id | ||
AND osm_gen0.type = osm.type | ||
); |