openmaptiles/layers/poi/layer.sql

14 wiersze
656 B
MySQL
Czysty Zwykły widok Historia

2016-10-28 16:01:31 +00:00
CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer, pixel_width numeric)
2016-10-29 08:57:06 +00:00
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text, gridrank int) AS $$
SELECT osm_id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass,
2016-10-28 16:01:31 +00:00
row_number() OVER (
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
ORDER BY poi_class_rank(poi_class(subclass)) ASC, length(name) DESC
2016-10-29 08:57:06 +00:00
)::int AS gridrank
2016-10-28 15:46:10 +00:00
FROM osm_poi_point
WHERE geometry && bbox
2016-10-28 16:01:31 +00:00
AND zoom_level >= 14
2016-10-28 15:46:10 +00:00
AND name <> ''
2016-10-28 16:01:31 +00:00
ORDER BY gridrank;
2016-10-28 15:46:10 +00:00
$$ LANGUAGE SQL IMMUTABLE;