Revamp water label display logic (#1457)
* At zooms 9-13, water labels will now be rendered for water features that are at least 0.25 tiles in size. This means that water features that are the same size as a 128x128 pixel square will get a point label. * Labels for large water features are now shown at the lowest zoom at which it's appropriate to show a label. * Bay and strait names (`natural=bay` and `natural=strait`) are included. * Large seas modeled as areas (e.g. Caspian Sea) render as `class=sea` rather than `class=lake`
This commit is contained in:
committed by
GitHub
parent
cd77b07e46
commit
af8c6883dd
@@ -2,14 +2,22 @@ DROP TRIGGER IF EXISTS trigger_delete_point ON osm_water_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_update_point ON osm_water_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_insert_point ON osm_water_polygon;
|
||||
|
||||
-- etldoc: osm_water_polygon -> osm_water_point_view
|
||||
-- etldoc: lake_centerline -> osm_water_point_view
|
||||
CREATE OR REPLACE VIEW osm_water_point_view AS
|
||||
SELECT wp.osm_id,
|
||||
ST_PointOnSurface(wp.geometry) AS geometry,
|
||||
wp.name,
|
||||
wp.name_en,
|
||||
wp.name_de,
|
||||
CASE
|
||||
WHEN "natural" = 'bay' THEN 'bay'
|
||||
WHEN place = 'sea' THEN 'sea'
|
||||
ELSE 'lake'
|
||||
END AS class,
|
||||
update_tags(wp.tags, ST_PointOnSurface(wp.geometry)) AS tags,
|
||||
ST_Area(wp.geometry) AS area,
|
||||
-- Area of the feature in square meters
|
||||
ST_Area(wp.geometry) as area,
|
||||
wp.is_intermittent
|
||||
FROM osm_water_polygon AS wp
|
||||
LEFT JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
|
||||
@@ -17,11 +25,25 @@ WHERE ll.osm_id IS NULL
|
||||
AND wp.name <> ''
|
||||
AND ST_IsValid(wp.geometry);
|
||||
|
||||
-- etldoc: osm_water_polygon -> osm_water_point
|
||||
-- etldoc: lake_centerline -> osm_water_point
|
||||
-- etldoc: osm_water_point_view -> osm_water_point_earth_view
|
||||
CREATE OR REPLACE VIEW osm_water_point_earth_view AS
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
class,
|
||||
tags,
|
||||
-- Percentage of the earth's surface covered by this feature (approximately)
|
||||
-- The constant below is 111,842^2 * 180 * 180, where 111,842 is the length of one degree of latitude at the equator in meters.
|
||||
area / (405279708033600 * COS(ST_Y(ST_Transform(geometry,4326))*PI()/180)) as earth_area,
|
||||
is_intermittent
|
||||
FROM osm_water_point_view;
|
||||
|
||||
-- etldoc: osm_water_point_earth_view -> osm_water_point
|
||||
CREATE TABLE IF NOT EXISTS osm_water_point AS
|
||||
SELECT *
|
||||
FROM osm_water_point_view;
|
||||
FROM osm_water_point_earth_view;
|
||||
DO
|
||||
$$
|
||||
BEGIN
|
||||
|
||||
Reference in New Issue
Block a user