kopia lustrzana https://github.com/openmaptiles/openmaptiles
Move place to imposm3 mapping
rodzic
a48123657c
commit
8bc57e13e7
|
@ -0,0 +1,33 @@
|
|||
tables:
|
||||
place_point:
|
||||
type: geometry
|
||||
fields:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- key: name
|
||||
name: name
|
||||
type: string
|
||||
- name: name_en
|
||||
key: name:en
|
||||
type: string
|
||||
- name: place
|
||||
key: place
|
||||
type: string
|
||||
- key: population
|
||||
name: population
|
||||
type: integer
|
||||
filters:
|
||||
exclude_tags:
|
||||
- [ "name", "__nil__" ]
|
||||
type_mappings:
|
||||
points:
|
||||
place:
|
||||
- city
|
||||
- town
|
||||
- village
|
||||
- hamlet
|
||||
- suburb
|
||||
- neighbourhood
|
||||
- isolated_dwelling
|
|
@ -1,70 +1,63 @@
|
|||
CREATE OR REPLACE VIEW place_z2 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
WHERE scalerank <= 0
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z3 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
WHERE scalerank <= 2
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z4 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
WHERE scalerank <= 5
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z5 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
WHERE scalerank <= 6
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z6 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
WHERE scalerank <= 7
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z7 AS (
|
||||
SELECT geom, name, 'settlement' AS class, 'city'::place AS rank, scalerank, pop_min AS population
|
||||
SELECT geom, name, 'city' AS place, scalerank, pop_min AS population
|
||||
FROM ne_10m_populated_places
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z8 AS (
|
||||
SELECT way AS geom, name, class::text, rank, NULL::integer AS scalerank, population FROM place_point
|
||||
WHERE rank IN ('city', 'town')
|
||||
SELECT geometry AS geom, name, place, NULL::integer AS scalerank, population FROM osm_place_point
|
||||
WHERE place IN ('city', 'town')
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z10 AS (
|
||||
SELECT way AS geom, name, class::text, rank, NULL::integer AS scalerank, population FROM place_point
|
||||
WHERE rank IN ('city', 'town', 'village') OR class='subregion'
|
||||
SELECT geometry AS geom, name, place, NULL::integer AS scalerank, population FROM osm_place_point
|
||||
WHERE place IN ('city', 'town', 'village') OR place='subregion'
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z11 AS (
|
||||
SELECT way AS geom, name, class::text, rank, NULL::integer AS scalerank, population FROM place_point
|
||||
WHERE class IN ('subregion', 'settlement')
|
||||
SELECT geometry AS geom, name, place, NULL::integer AS scalerank, population FROM osm_place_point
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW place_z13 AS (
|
||||
SELECT way AS geom, name, class::text, rank, NULL::integer AS scalerank, population FROM place_point
|
||||
SELECT geometry AS geom, name, place, NULL::integer AS scalerank, population FROM osm_place_point
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_place(bbox geometry, zoom_level int, pixel_width numeric)
|
||||
RETURNS TABLE(geom geometry, name text, class text, rank text, scalerank int) AS $$
|
||||
SELECT geom, name, class, rank::text, scalerank FROM (
|
||||
SELECT geom, name, class, rank, scalerank,
|
||||
RETURNS TABLE(geom geometry, name text, place text, scalerank int) AS $$
|
||||
SELECT geom, name, place, scalerank FROM (
|
||||
SELECT geom, name, place, scalerank,
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geom, 150 * pixel_width)
|
||||
ORDER BY scalerank ASC NULLS LAST,
|
||||
CASE class
|
||||
WHEN 'settlement' THEN 10
|
||||
WHEN 'subregion' THEN 5
|
||||
WHEN 'locality' THEN 2 ELSE 1
|
||||
END DESC,
|
||||
rank DESC,
|
||||
population DESC NULLS LAST,
|
||||
length(name) DESC
|
||||
) AS gridrank
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
layer:
|
||||
id: "place"
|
||||
description: place
|
||||
description: [OSM Places](http://wiki.openstreetmap.org/wiki/Key:place)
|
||||
buffer_size: 128
|
||||
datasource:
|
||||
query: (SELECT * FROM layer_place(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
||||
schema:
|
||||
- ./place.sql
|
||||
datasources:
|
||||
- type: imposm3
|
||||
mapping_file: ./mapping.yaml
|
||||
|
|
Ładowanie…
Reference in New Issue