kopia lustrzana https://github.com/openmaptiles/openmaptiles
Add gridrank attribute
rodzic
dbec752ed1
commit
f3e2d7f163
|
@ -1,3 +1,33 @@
|
|||
CREATE OR REPLACE FUNCTION poi_class_rank(class TEXT)
|
||||
RETURNS INT AS $$
|
||||
SELECT CASE class
|
||||
WHEN 'hospital' THEN 20
|
||||
WHEN 'park' THEN 25
|
||||
WHEN 'cemetery' THEN 30
|
||||
WHEN 'bus' THEN 50
|
||||
WHEN 'attraction' THEN 70
|
||||
WHEN 'harbor' THEN 75
|
||||
WHEN 'college' THEN 80
|
||||
WHEN 'school' THEN 85
|
||||
WHEN 'stadium' THEN 90
|
||||
WHEN 'zoo' THEN 95
|
||||
WHEN 'town_hall' THEN 100
|
||||
WHEN 'campsite' THEN 110
|
||||
WHEN 'cemetery' THEN 115
|
||||
WHEN 'park' THEN 120
|
||||
WHEN 'library' THEN 130
|
||||
WHEN 'police' THEN 135
|
||||
WHEN 'post' THEN 140
|
||||
WHEN 'golf' THEN 150
|
||||
WHEN 'shop' THEN 400
|
||||
WHEN 'grocery' THEN 500
|
||||
WHEN 'fast_food' THEN 600
|
||||
WHEN 'clothing_store' THEN 700
|
||||
WHEN 'bar' THEN 800
|
||||
ELSE 1000
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION poi_class(subclass TEXT)
|
||||
RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer)
|
||||
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text) AS $$
|
||||
SELECT id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass
|
||||
CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer, pixel_width numeric)
|
||||
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text, gridrank bigint) AS $$
|
||||
SELECT id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass,
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
|
||||
ORDER BY poi_class_rank(poi_class(subclass)) ASC, length(name) DESC
|
||||
) AS gridrank
|
||||
FROM osm_poi_point
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 14
|
||||
AND name <> ''
|
||||
AND (zoom_level >= 14);
|
||||
ORDER BY gridrank;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
|
|
@ -9,7 +9,7 @@ layer:
|
|||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, name, name_en, class, subclass FROM layer_poi(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, name, name_en, class, subclass, gridrank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
||||
schema:
|
||||
- ./class.sql
|
||||
- ./layer.sql
|
||||
|
|
Ładowanie…
Reference in New Issue