kopia lustrzana https://github.com/openmaptiles/openmaptiles
Adjust zoom levels of transportation_name, update diagrams
rodzic
665f8ac9ca
commit
fad3cab2cd
|
@ -4,8 +4,7 @@
|
|||
Read the layer documentation at **http://openmaptiles.org/schema#transportation_name**
|
||||
|
||||
### Mapping Diagram
|
||||

|
||||

|
||||
|
||||
### ETL diagram
|
||||

|
||||
|
||||

|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 237 KiB |
|
@ -1,6 +1,6 @@
|
|||
|
||||
-- etldoc: layer_transportation_name[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="layer_transportation_name | <z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
|
||||
-- etldoc: label="layer_transportation_name | <z6> z6 | <z7> z7 | <z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer)
|
||||
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, ref text, ref_length int, network text, class text) AS $$
|
||||
|
@ -23,20 +23,21 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, ref tex
|
|||
WHERE zoom_level = 6
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen3 -> layer_transportation_name:z7z8
|
||||
-- etldoc: osm_transportation_name_linestring_gen3 -> layer_transportation_name:z7
|
||||
SELECT * FROM osm_transportation_name_linestring_gen3
|
||||
WHERE zoom_level BETWEEN 7 AND 8
|
||||
WHERE zoom_level = 7
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z9
|
||||
-- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z8
|
||||
SELECT * FROM osm_transportation_name_linestring_gen2
|
||||
WHERE zoom_level = 9
|
||||
WHERE zoom_level = 8
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z9
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z10
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z11
|
||||
SELECT * FROM osm_transportation_name_linestring_gen1
|
||||
WHERE zoom_level BETWEEN 10 AND 11
|
||||
WHERE zoom_level BETWEEN 9 AND 11
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z12
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 56 KiB |
|
@ -7,6 +7,8 @@ DROP TRIGGER IF EXISTS trigger_refresh ON transportation_name.updates;
|
|||
-- Because this works well for roads that do not have relations as well
|
||||
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_name_network
|
||||
-- etldoc: osm_route_member -> osm_transportation_name_network
|
||||
CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
|
||||
SELECT
|
||||
hl.geometry,
|
||||
|
@ -29,7 +31,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
|
|||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_geometry_idx ON osm_transportation_name_network USING gist(geometry);
|
||||
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_name_linestring
|
||||
-- etldoc: osm_transportation_name_network -> osm_transportation_name_linestring
|
||||
CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
||||
SELECT
|
||||
(ST_Dump(geometry)).geom AS geometry,
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
select ref, highway, network,
|
||||
case
|
||||
when network is not null
|
||||
then network::text
|
||||
when length(coalesce(ref, ''))>0
|
||||
then 'motorway'
|
||||
end as shield
|
||||
from osm_transportation_name_linestring;
|
||||
|
||||
|
||||
|
||||
SELECT
|
||||
rm.network,
|
||||
rm.ref::text as network_ref,
|
||||
hl.ref as road_ref,
|
||||
hl.highway,
|
||||
ROW_NUMBER() OVER(PARTITION BY hl.osm_id
|
||||
ORDER BY rm.network) AS "rank"
|
||||
FROM osm_highway_linestring hl
|
||||
left join osm_route_member rm on (rm.member = hl.osm_id)
|
||||
;
|
||||
|
||||
select network, count(*)
|
||||
from osm_route_member
|
||||
group by network;
|
||||
|
||||
select network, ref, count(*)
|
||||
from osm_route_member
|
||||
group by network, ref
|
||||
order by network, ref;
|
||||
|
||||
select *
|
||||
from osm_route_member
|
||||
where ref::int < 3;
|
||||
|
||||
|
||||
select ref, network, name, count(*)
|
||||
from osm_route_member
|
||||
where name like '%Trans-Canada Highway%'
|
||||
group by ref, network, name;
|
||||
|
||||
|
||||
select ref, count(*)
|
||||
from osm_highway_linestring
|
||||
group by (ref)
|
||||
order by count(*) desc;
|
||||
|
||||
select ref, highway, count(*)
|
||||
from osm_highway_linestring
|
||||
where length(ref)>0
|
||||
and ref like 'A%' or ref like 'M%'
|
||||
group by ref, highway
|
||||
order by count(*) desc;
|
||||
|
||||
select ref, count(*)
|
||||
from osm_highway_linestring
|
||||
where length(ref)>0
|
||||
and ref like 'A%' or ref like 'M%'
|
||||
group by ref
|
||||
order by count(*) desc;
|
||||
|
||||
|
||||
select ref, count(*)
|
||||
from osm_highway_linestring
|
||||
where length(ref)>0
|
||||
and highway = 'motorway'
|
||||
group by ref
|
||||
order by count(*) desc;
|
||||
|
||||
select count(hw.*)
|
||||
from osm_highway_linestring hw CROSS JOIN ne_10m_admin_0_countries c
|
||||
where c.iso_a2 = 'GB'
|
||||
AND ST_Intersects(hw.geometry, c.geometry);
|
||||
|
||||
select hw.osm_id, hw.name, hw.ref
|
||||
from osm_highway_linestring hw CROSS JOIN ne_10m_admin_0_countries c
|
||||
where c.iso_a2 = 'GB'
|
||||
AND not ST_Intersects(hw.geometry, c.geometry);
|
||||
|
||||
|
||||
|
||||
select count(*)
|
||||
from osm_highway_linestring;
|
||||
|
||||
|
||||
select * from ne_10m_admin_0_countries;
|
||||
select name, ST_GeometryType(geometry) from ne_10m_admin_0_countries where iso_a2 = 'GB';
|
||||
select geometry from ne_10m_admin_0_countries where iso_a2 = 'GB';
|
||||
|
||||
|
||||
with gb_geom as (select geometry from ne_10m_admin_0_countries where iso_a2 = 'GB')
|
||||
select hw.osm_id, hw.name, hw.ref
|
||||
from osm_highway_linestring hw
|
||||
where not ST_Intersects(hw.geometry, gb_geom);
|
||||
|
||||
|
||||
DO $$
|
||||
DECLARE gbr_geom geometry;
|
||||
BEGIN
|
||||
select geometry into gbr_geom from ne_10m_admin_0_countries where iso_a2 = 'GB';
|
||||
select hw.osm_id, hw.name, hw.ref
|
||||
from osm_highway_linestring hw
|
||||
where not ST_Intersects(hw.geometry, gbr_geom);
|
||||
-- ...
|
||||
END $$;
|
||||
|
||||
|
||||
DO $$
|
||||
DECLARE gbr_geom geometry;
|
||||
BEGIN
|
||||
select st_buffer(geometry, 1000) into gbr_geom from ne_10m_admin_0_countries where iso_a2 = 'GB';
|
||||
delete from osm_route_member where network IN('omt-gb-motorway', 'omt-gb-trunk');
|
||||
|
||||
insert into osm_route_member (member, ref, network)
|
||||
(
|
||||
SELECT hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-motorway'
|
||||
from osm_highway_linestring hw
|
||||
where length(hw.ref)>0 and ST_Intersects(hw.geometry, gbr_geom)
|
||||
and hw.highway IN ('motorway')
|
||||
) UNION (
|
||||
SELECT hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-trunk'
|
||||
from osm_highway_linestring hw
|
||||
where length(hw.ref)>0
|
||||
and hw.highway IN ('trunk')
|
||||
)
|
||||
;
|
||||
END $$;
|
||||
|
||||
|
||||
SELECT hw.osm_id, hw.ref, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-motorway'
|
||||
from osm_highway_linestring hw
|
||||
where length(hw.ref)>0
|
||||
and hw.highway IN ('motorway');
|
||||
|
||||
SELECT hw.osm_id, hw.ref, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-trunk'
|
||||
from osm_highway_linestring hw
|
||||
where length(hw.ref)>0
|
||||
and hw.highway IN ('trunk');
|
Ładowanie…
Reference in New Issue