openmaptiles/layers/poi/layer.sql

14 wiersze
650 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)
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
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;