2020-06-08 16:19:55 +00:00
|
|
|
CREATE OR REPLACE FUNCTION highway_is_link(highway text) RETURNS boolean AS
|
Parallel capability to layer functions (#728)
This PR allows queries to be parallelized on recent versions of Postgres. The `PARALLEL SAFE` modifier has been added to the layer functions and a PLPGSQL function to convert strings into number has been replaced.
`PARALLEL SAFE` is a modifier for `CREATE FUNCTION` available since Postgres 9.6, so this change does not break current OpenMapTiles supported database version. More details about this topic [here](https://www.postgresql.org/docs/current/parallel-safety.html) and at the reference documentation for [`CREATE FUNCTION`](https://www.postgresql.org/docs/current/sql-createfunction.html).
### Testing procedure
The procedure to test this was:
* Imported `spain.pbf` in a clean environment
* Dumped the OpenMapTiles database from the Postgres Docker image
* Created a clean Postgres 12 database using the default Docker image
* Installed `postgis` 3 from the default Debian package and `osml10n` 2.5.8 from the repository (`make`, etc.)
* Restored the dump
* Lowered the postgres planner parameters for triggering parallel plans:
```sql
set parallel_setup_cost = 5;
set parallel_tuple_cost = 0.005;
```
* Manually added the `PARALLEL SAFE` modifier to each function involved in layer queries (not on updates or inserting functions).
* For each layer, run a testing query to confirm parallel workers were created, something like this:
```sql
explain analyze
select * from layer_aerodrome_label(tilebbox(8,128,95),10,null)
union all
select * from layer_aerodrome_label(tilebbox(8,128,97),10,null);
```
* After all the layers were processed and confirmed to start parallel executions, a more complete example was run. This example just retrieves the geometries for all the layers from the same tile but without using any MVT related function.
<details><summary>Testing query</summary>
```sql
-- Using the function layer_landuse
explain analyze
select geometry from layer_water(tilebbox(14,8020,6178),14)
union all
select geometry from layer_waterway(tilebbox(14,8020,6178),14)
union all
select geometry from layer_landcover(tilebbox(14,8020,6178),14)
union all
select geometry from layer_landuse(tilebbox(14,8020,6178),14)
union all
select geometry from layer_mountain_peak(tilebbox(14,8020,6178),14)
union all
select geometry from layer_park(tilebbox(14,8020,6178),14)
union all
select geometry from layer_boundary(tilebbox(14,8020,6178),14)
union all
select geometry from layer_aeroway(tilebbox(14,8020,6178),14)
union all
select geometry from layer_transportation(tilebbox(14,8020,6178),14)
union all
select geometry from layer_building(tilebbox(14,8020,6178),14)
union all
select geometry from layer_water_name(tilebbox(14,8020,6178),14)
union all
select geometry from layer_transportation_name(tilebbox(14,8020,6178),14)
union all
select geometry from layer_place(tilebbox(14,8020,6178),14)
union all
select geometry from layer_housenumber(tilebbox(14,8020,6178),14)
union all
select geometry from layer_poi(tilebbox(14,8020,6178),14)
union all
select geometry from layer_aerodrome_label(tilebbox(14,8020,6178),14);
```
</details>
You can inspect the execution plan and results on [this page](https://explain.dalibo.com/plan/3z). Also [attaching](https://github.com/openmaptiles/openmaptiles/files/3951822/explain-tile-simple.tar.gz) the query and JSON output for future reference. The website gives a ton of details, but you may want to search for nodes mentioning `workers` or `parallel` like in this area referring to `osm_border` or `osm_aeroway_linestring` entities

### Next steps
Since the execution plan is not showing a parallel append at the top level, meaning it's not running each layer individually, I want to continue experimenting with parameters and queries to see if it's possible to even parallelize more the request.
I will post my finding here, even no change in the code should happen.
cc. @nyurik
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2020-02-01 00:36:02 +00:00
|
|
|
$$
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT highway LIKE '%_link';
|
|
|
|
$$ LANGUAGE SQL IMMUTABLE
|
|
|
|
STRICT
|
|
|
|
PARALLEL SAFE;
|
2016-10-10 18:17:05 +00:00
|
|
|
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2016-11-26 20:19:43 +00:00
|
|
|
-- etldoc: layer_transportation[shape=record fillcolor=lightpink, style="rounded,filled",
|
2017-07-20 17:41:56 +00:00
|
|
|
-- etldoc: label="<sql> layer_transportation |<z4> z4 |<z5> z5 |<z6> z6 |<z7> z7 |<z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
|
2016-11-26 20:19:43 +00:00
|
|
|
CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int)
|
2020-06-08 16:19:55 +00:00
|
|
|
RETURNS TABLE
|
|
|
|
(
|
2021-11-26 06:55:20 +00:00
|
|
|
osm_id bigint,
|
|
|
|
geometry geometry,
|
|
|
|
class text,
|
|
|
|
subclass text,
|
|
|
|
network text,
|
|
|
|
ramp int,
|
|
|
|
oneway int,
|
|
|
|
brunnel text,
|
|
|
|
service text,
|
|
|
|
access text,
|
|
|
|
toll int,
|
|
|
|
expressway int,
|
|
|
|
layer int,
|
|
|
|
level int,
|
|
|
|
indoor int,
|
|
|
|
bicycle text,
|
|
|
|
foot text,
|
|
|
|
horse text,
|
|
|
|
mtb_scale text,
|
|
|
|
surface text
|
2020-06-08 16:19:55 +00:00
|
|
|
)
|
|
|
|
AS
|
|
|
|
$$
|
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
CASE
|
2021-09-20 09:19:24 +00:00
|
|
|
WHEN highway <> '' OR public_transport <> ''
|
2020-06-08 16:19:55 +00:00
|
|
|
THEN highway_class(highway, public_transport, construction)
|
2021-09-20 09:19:24 +00:00
|
|
|
WHEN railway <> '' THEN railway_class(railway)
|
|
|
|
WHEN aerialway <> '' THEN 'aerialway'
|
|
|
|
WHEN shipway <> '' THEN shipway
|
|
|
|
WHEN man_made <> '' THEN man_made
|
2020-07-22 11:48:25 +00:00
|
|
|
END AS class,
|
2020-06-08 16:19:55 +00:00
|
|
|
CASE
|
|
|
|
WHEN railway IS NOT NULL THEN railway
|
|
|
|
WHEN (highway IS NOT NULL OR public_transport IS NOT NULL)
|
|
|
|
AND highway_class(highway, public_transport, construction) = 'path'
|
|
|
|
THEN COALESCE(NULLIF(public_transport, ''), highway)
|
2020-10-12 10:44:33 +00:00
|
|
|
WHEN aerialway IS NOT NULL THEN aerialway
|
2020-07-22 11:48:25 +00:00
|
|
|
END AS subclass,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULLIF(network, '') AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
-- All links are considered as ramps as well
|
|
|
|
CASE
|
2021-10-28 13:08:56 +00:00
|
|
|
WHEN highway_is_link(highway)
|
|
|
|
OR is_ramp
|
|
|
|
THEN 1 END AS ramp,
|
2021-10-28 13:39:34 +00:00
|
|
|
CASE WHEN is_oneway <> 0 THEN is_oneway::int END AS oneway,
|
2020-06-08 16:19:55 +00:00
|
|
|
brunnel(is_bridge, is_tunnel, is_ford) AS brunnel,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULLIF(service, '') AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
access,
|
2021-08-19 05:12:10 +00:00
|
|
|
CASE WHEN toll = TRUE THEN 1 END AS toll,
|
2021-11-26 06:55:20 +00:00
|
|
|
CASE WHEN highway NOT IN ('', 'motorway') AND expressway = TRUE THEN 1 END AS expressway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULLIF(layer, 0) AS layer,
|
2020-06-08 16:19:55 +00:00
|
|
|
"level",
|
2020-07-22 11:48:25 +00:00
|
|
|
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
|
|
|
|
NULLIF(bicycle, '') AS bicycle,
|
|
|
|
NULLIF(foot, '') AS foot,
|
|
|
|
NULLIF(horse, '') AS horse,
|
|
|
|
NULLIF(mtb_scale, '') AS mtb_scale,
|
|
|
|
NULLIF(surface, '') AS surface
|
2020-06-08 16:19:55 +00:00
|
|
|
FROM (
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z4 -> layer_transportation:z4
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-11-11 13:37:09 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z4
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 4
|
|
|
|
UNION ALL
|
2017-03-15 10:05:16 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z5 -> layer_transportation:z5
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-11-11 13:37:09 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z5
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 5
|
|
|
|
UNION ALL
|
2017-03-29 18:49:20 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z6 -> layer_transportation:z6
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-11-11 13:37:09 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z6
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 6
|
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z7 -> layer_transportation:z7
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-11-11 13:37:09 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z7
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 7
|
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z8 -> layer_transportation:z8
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-11-11 13:37:09 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z8
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 8
|
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2021-04-30 13:39:56 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z9 -> layer_transportation:z9
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
access,
|
2021-08-19 05:12:10 +00:00
|
|
|
toll,
|
2020-10-14 12:26:43 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
|
|
|
bicycle,
|
|
|
|
foot,
|
|
|
|
horse,
|
|
|
|
mtb_scale,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2021-04-30 13:39:56 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z9
|
2020-11-26 12:54:00 +00:00
|
|
|
WHERE zoom_level = 9
|
|
|
|
UNION ALL
|
|
|
|
|
2021-04-30 13:39:56 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z10 -> layer_transportation:z10
|
2020-11-26 12:54:00 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-11-26 12:54:00 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
access,
|
2021-08-19 05:12:10 +00:00
|
|
|
toll,
|
2020-11-26 12:54:00 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-11-26 12:54:00 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
layer,
|
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
bicycle,
|
|
|
|
foot,
|
|
|
|
horse,
|
|
|
|
mtb_scale,
|
|
|
|
NULL AS surface,
|
|
|
|
z_order
|
2021-04-30 13:39:56 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z10
|
2020-11-26 12:54:00 +00:00
|
|
|
WHERE zoom_level = 10
|
2020-06-08 16:19:55 +00:00
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2021-04-30 13:39:56 +00:00
|
|
|
-- etldoc: osm_transportation_merge_linestring_gen_z11 -> layer_transportation:z11
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
access,
|
2021-08-19 05:12:10 +00:00
|
|
|
toll,
|
2020-10-14 12:26:43 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
|
|
|
bicycle,
|
|
|
|
foot,
|
|
|
|
horse,
|
|
|
|
mtb_scale,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2021-04-30 13:39:56 +00:00
|
|
|
FROM osm_transportation_merge_linestring_gen_z11
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 11
|
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_highway_linestring -> layer_transportation:z12
|
|
|
|
-- etldoc: osm_highway_linestring -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_highway_linestring -> layer_transportation:z14_
|
2021-11-18 16:35:34 +00:00
|
|
|
-- etldoc: osm_transportation_name_network -> layer_transportation:z12
|
|
|
|
-- etldoc: osm_transportation_name_network -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_transportation_name_network -> layer_transportation:z14_
|
|
|
|
SELECT hl.osm_id,
|
|
|
|
hl.geometry,
|
|
|
|
hl.highway,
|
2020-06-08 16:19:55 +00:00
|
|
|
construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
2020-06-08 16:19:55 +00:00
|
|
|
public_transport,
|
2020-07-22 11:48:25 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
CASE WHEN access IN ('private', 'no') THEN 'no' END AS access,
|
2021-10-13 18:43:14 +00:00
|
|
|
toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
|
|
|
man_made,
|
2021-11-18 16:35:34 +00:00
|
|
|
hl.layer,
|
|
|
|
CASE WHEN hl.highway IN ('footway', 'steps') THEN hl.level END AS level,
|
|
|
|
CASE WHEN hl.highway IN ('footway', 'steps') THEN hl.indoor END AS indoor,
|
2020-06-08 16:19:55 +00:00
|
|
|
bicycle,
|
|
|
|
foot,
|
|
|
|
horse,
|
|
|
|
mtb_scale,
|
2020-07-22 11:48:25 +00:00
|
|
|
surface_value(surface) AS "surface",
|
2021-11-18 16:35:34 +00:00
|
|
|
hl.z_order
|
|
|
|
FROM osm_highway_linestring hl
|
|
|
|
LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE NOT is_area
|
2021-09-20 06:07:38 +00:00
|
|
|
AND
|
2021-11-18 16:35:34 +00:00
|
|
|
CASE WHEN zoom_level = 12 THEN
|
|
|
|
CASE WHEN transportation_filter_z12(hl.highway, hl.construction) THEN TRUE
|
2022-01-05 06:28:34 +00:00
|
|
|
WHEN hl.highway IN ('track', 'path') THEN n.route_rank = 1
|
2021-11-18 16:35:34 +00:00
|
|
|
END
|
2021-09-20 06:07:38 +00:00
|
|
|
WHEN zoom_level = 13 THEN
|
2021-11-18 16:35:34 +00:00
|
|
|
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(hl.geometry)
|
2022-01-05 06:28:34 +00:00
|
|
|
WHEN hl.highway IN ('track', 'path') THEN (hl.name <> ''
|
|
|
|
OR n.route_rank BETWEEN 1 AND 2
|
|
|
|
OR hl.sac_scale <> ''
|
|
|
|
)
|
2021-11-18 16:35:34 +00:00
|
|
|
ELSE transportation_filter_z13(hl.highway, public_transport, hl.construction, service)
|
2021-09-20 06:07:38 +00:00
|
|
|
END
|
|
|
|
WHEN zoom_level >= 14 THEN
|
2021-11-18 16:35:34 +00:00
|
|
|
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(hl.geometry)
|
2021-09-20 06:07:38 +00:00
|
|
|
ELSE TRUE
|
|
|
|
END
|
|
|
|
END
|
2020-06-08 16:19:55 +00:00
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring_gen_z8 -> layer_transportation:z8
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::boolean AS is_bridge,
|
|
|
|
NULL::boolean AS is_tunnel,
|
|
|
|
NULL::boolean AS is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
|
|
|
NULL::int AS layer,
|
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_railway_linestring_gen_z8
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 8
|
|
|
|
AND railway = 'rail'
|
|
|
|
AND service = ''
|
|
|
|
AND usage = 'main'
|
|
|
|
UNION ALL
|
2017-09-21 17:32:56 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring_gen_z9 -> layer_transportation:z9
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::boolean AS is_bridge,
|
|
|
|
NULL::boolean AS is_tunnel,
|
|
|
|
NULL::boolean AS is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::boolean AS is_ramp,
|
|
|
|
NULL::int AS is_oneway,
|
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_railway_linestring_gen_z9
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 9
|
|
|
|
AND railway = 'rail'
|
|
|
|
AND service = ''
|
|
|
|
AND usage = 'main'
|
|
|
|
UNION ALL
|
2017-09-21 17:32:56 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring_gen_z10 -> layer_transportation:z10
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_railway_linestring_gen_z10
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 10
|
|
|
|
AND railway IN ('rail', 'narrow_gauge')
|
|
|
|
AND service = ''
|
|
|
|
UNION ALL
|
2017-05-31 13:28:06 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring_gen_z11 -> layer_transportation:z11
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_railway_linestring_gen_z11
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 11
|
|
|
|
AND railway IN ('rail', 'narrow_gauge', 'light_rail')
|
|
|
|
AND service = ''
|
|
|
|
UNION ALL
|
2017-01-20 16:46:47 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring_gen_z12 -> layer_transportation:z12
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_railway_linestring_gen_z12
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 12
|
|
|
|
AND railway IN ('rail', 'narrow_gauge', 'light_rail')
|
|
|
|
AND service = ''
|
|
|
|
UNION ALL
|
2017-01-20 16:46:47 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_railway_linestring -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_railway_linestring -> layer_transportation:z14_
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-06-08 16:19:55 +00:00
|
|
|
railway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
|
|
|
FROM osm_railway_linestring
|
|
|
|
WHERE zoom_level = 13
|
2020-11-26 12:54:00 +00:00
|
|
|
AND railway IN ('rail', 'narrow_gauge', 'light_rail')
|
|
|
|
AND service = ''
|
|
|
|
OR zoom_level >= 14
|
2020-06-08 16:19:55 +00:00
|
|
|
UNION ALL
|
2016-11-07 14:37:17 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_aerialway_linestring_gen_z12 -> layer_transportation:z12
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
2020-06-08 16:19:55 +00:00
|
|
|
aerialway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_aerialway_linestring_gen_z12
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 12
|
|
|
|
UNION ALL
|
2017-09-22 12:41:18 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_aerialway_linestring -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_aerialway_linestring -> layer_transportation:z14_
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
2020-06-08 16:19:55 +00:00
|
|
|
aerialway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS shipway,
|
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
|
|
|
FROM osm_aerialway_linestring
|
|
|
|
WHERE zoom_level >= 13
|
|
|
|
UNION ALL
|
2017-09-22 12:41:18 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_shipway_linestring_gen_z11 -> layer_transportation:z11
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
2020-06-08 16:19:55 +00:00
|
|
|
shipway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_shipway_linestring_gen_z11
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 11
|
|
|
|
UNION ALL
|
2017-09-25 11:12:19 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_shipway_linestring_gen_z12 -> layer_transportation:z12
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
2020-06-08 16:19:55 +00:00
|
|
|
shipway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
2020-11-26 12:54:00 +00:00
|
|
|
FROM osm_shipway_linestring_gen_z12
|
2020-06-08 16:19:55 +00:00
|
|
|
WHERE zoom_level = 12
|
|
|
|
UNION ALL
|
2017-09-25 11:12:19 +00:00
|
|
|
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_shipway_linestring -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_shipway_linestring -> layer_transportation:z14_
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS highway,
|
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
2020-06-08 16:19:55 +00:00
|
|
|
shipway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS public_transport,
|
2020-06-08 16:19:55 +00:00
|
|
|
service_value(service) AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_bridge,
|
|
|
|
is_tunnel,
|
|
|
|
is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-06-08 16:19:55 +00:00
|
|
|
is_ramp,
|
|
|
|
is_oneway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS man_made,
|
2020-06-08 16:19:55 +00:00
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
|
|
|
NULL::boolean AS indoor,
|
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
|
|
|
FROM osm_shipway_linestring
|
|
|
|
WHERE zoom_level >= 13
|
|
|
|
UNION ALL
|
2017-09-25 11:12:19 +00:00
|
|
|
|
2020-06-08 16:19:55 +00:00
|
|
|
-- NOTE: We limit the selection of polys because we need to be
|
|
|
|
-- careful to net get false positives here because
|
|
|
|
-- it is possible that closed linestrings appear both as
|
|
|
|
-- highway linestrings and as polygon
|
2020-11-26 12:54:00 +00:00
|
|
|
-- etldoc: osm_highway_polygon -> layer_transportation:z13
|
|
|
|
-- etldoc: osm_highway_polygon -> layer_transportation:z14_
|
2020-06-08 16:19:55 +00:00
|
|
|
SELECT osm_id,
|
|
|
|
geometry,
|
|
|
|
highway,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS construction,
|
2021-08-04 08:10:16 +00:00
|
|
|
NULL AS network,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS railway,
|
|
|
|
NULL AS aerialway,
|
|
|
|
NULL AS shipway,
|
2020-06-08 16:19:55 +00:00
|
|
|
public_transport,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS service,
|
2021-08-14 05:04:17 +00:00
|
|
|
NULL::text AS access,
|
2021-08-19 05:12:10 +00:00
|
|
|
NULL::boolean AS toll,
|
2020-06-08 16:19:55 +00:00
|
|
|
CASE
|
|
|
|
WHEN man_made IN ('bridge') THEN TRUE
|
|
|
|
ELSE FALSE
|
2020-07-22 11:48:25 +00:00
|
|
|
END AS is_bridge,
|
|
|
|
FALSE AS is_tunnel,
|
|
|
|
FALSE AS is_ford,
|
2021-11-26 06:55:20 +00:00
|
|
|
NULL::boolean AS expressway,
|
2020-07-22 11:48:25 +00:00
|
|
|
FALSE AS is_ramp,
|
|
|
|
FALSE::int AS is_oneway,
|
2020-06-08 16:19:55 +00:00
|
|
|
man_made,
|
|
|
|
layer,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL::int AS level,
|
2020-06-08 16:19:55 +00:00
|
|
|
NULL::boolean AS indoor,
|
2020-07-22 11:48:25 +00:00
|
|
|
NULL AS bicycle,
|
|
|
|
NULL AS foot,
|
|
|
|
NULL AS horse,
|
|
|
|
NULL AS mtb_scale,
|
|
|
|
NULL AS surface,
|
2020-06-08 16:19:55 +00:00
|
|
|
z_order
|
|
|
|
FROM osm_highway_polygon
|
|
|
|
-- We do not want underground pedestrian areas for now
|
|
|
|
WHERE zoom_level >= 13
|
|
|
|
AND (
|
|
|
|
man_made IN ('bridge', 'pier')
|
|
|
|
OR (is_area AND COALESCE(layer, 0) >= 0)
|
|
|
|
)
|
|
|
|
) AS zoom_levels
|
|
|
|
WHERE geometry && bbox
|
|
|
|
ORDER BY z_order ASC;
|
2020-06-17 16:15:26 +00:00
|
|
|
$$ LANGUAGE SQL STABLE
|
|
|
|
-- STRICT
|
2020-06-08 16:19:55 +00:00
|
|
|
PARALLEL SAFE;
|