kopia lustrzana https://github.com/openmaptiles/openmaptiles
Incorporate grid rank into city rank
rodzic
52e133e126
commit
28a87c9e81
|
@ -11,8 +11,12 @@ We suggest you use different font styles and sizes to create a text hierarchy.
|
|||
- **name**: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
- **rank**: Countries, states and the most important cities all have a `rank` to boost their importance on the map.
|
||||
The `rank` field for counries and states ranges from `1` to `6` while the `rank` field for
|
||||
cities ranges from `1` to `10`. Use the `rank` field to build a text hierarchy.
|
||||
The rank value is a combination of the Natural Earth `scalerank`, `labelrank` and `datarank` values.
|
||||
cities ranges from `1` to `10` for the most important cities and continues from `10` serially based
|
||||
on the local importance of the city (derived from population and city class).
|
||||
Use the `rank` field to build a text hierarchy.
|
||||
The rank value is a combination of the Natural Earth `scalerank`, `labelrank` and `datarank` values for countries
|
||||
and states and for cities consists out of a shifted Natural Earth `scalerank` combined with a local rank
|
||||
within a grid for cities that do not have a Natural Earth `scalerank`.
|
||||
- **class**: Distinguish between `country`, `state` and other city classes like
|
||||
`city`, `town`, `village`, `hamlet`, `suburb`, `neighbourhood` or `isolated_dwelling`.
|
||||
Use this to separately style the different places according to their importance (usually country and state different
|
||||
|
|
|
@ -7,14 +7,15 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class c
|
|||
OR (zoom_level BETWEEN 3 AND 7 AND "rank" <= zoom_level)
|
||||
)
|
||||
UNION ALL
|
||||
SELECT osm_id, geometry, name, name_en, place, "rank" FROM (
|
||||
SELECT osm_id, geometry, name, name_en, place, "rank",
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 150 * pixel_width)
|
||||
ORDER BY place ASC NULLS LAST,
|
||||
population DESC NULLS LAST,
|
||||
length(name) DESC
|
||||
) AS gridrank
|
||||
SELECT osm_id, geometry, name, name_en, place, COALESCE("rank", gridrank + 10) FROM (
|
||||
SELECT osm_id, geometry, name, name_en, place, "rank",
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 150 * pixel_width)
|
||||
ORDER BY "rank" ASC NULLS LAST,
|
||||
place ASC NULLS LAST,
|
||||
population DESC NULLS LAST,
|
||||
length(name) ASC
|
||||
)::int AS gridrank
|
||||
FROM osm_city_point
|
||||
WHERE geometry && bbox
|
||||
AND ((zoom_level BETWEEN 8 AND 9 AND place <= 'town'::city_class)
|
||||
|
@ -23,7 +24,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class c
|
|||
OR (zoom_level >= 14)
|
||||
)
|
||||
) AS ranked_places
|
||||
WHERE (zoom_level = 8 AND gridrank <= 4)
|
||||
OR (zoom_level BETWEEN 9 AND 12 AND gridrank <= 9)
|
||||
WHERE (zoom_level = 8 AND (gridrank <= 4 OR "rank" IS NOT NULL))
|
||||
OR (zoom_level BETWEEN 9 AND 12 AND (gridrank <= 9 OR "rank" IS NOT NULL))
|
||||
OR (zoom_level >= 13);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
|
|
@ -16,9 +16,12 @@ layer:
|
|||
rank: |
|
||||
Countries, states and the most important cities all have a `rank` to boost their importance on the map.
|
||||
The `rank` field for counries and states ranges from `1` to `6` while the `rank` field for
|
||||
cities ranges from `1` to `10`. Use the `rank` field to build a text hierarchy.
|
||||
cities ranges from `1` to `10` for the most important cities and continues from `10` serially based
|
||||
on the local importance of the city (derived from population and city class).
|
||||
Use the `rank` field to build a text hierarchy.
|
||||
The rank value is a combination of the Natural Earth `scalerank`, `labelrank` and `datarank` values for countries
|
||||
and states and a shifted Natural Earth `scalerank` for cities.
|
||||
and states and for cities consists out of a shifted Natural Earth `scalerank` combined with a local rank
|
||||
within a grid for cities that do not have a Natural Earth `scalerank`.
|
||||
buffer_size: 128
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
|
|
Ładowanie…
Reference in New Issue