Fix negative feature IDs (#1185)
This PR removes the possibility of negative feature IDs for the `aerodrome_label` layer by defining the feature as the absolute value of the OSM id (imposm maps relations with negative numbers). There is a very unlikely scenario in which a relation and a way have the same ID (and are also in the same tile), however, unique IDs are not a strict requirement of MVT. Noted in: https://github.com/openmaptiles/openmaptiles/pull/1176#issuecomment-902503655 Positive feature ID for Quonset State Airport, which is mapped as a relation: 
This commit is contained in:
parent
36bd917e05
commit
6ef138635d
@ -5,7 +5,7 @@ CREATE OR REPLACE FUNCTION layer_aerodrome_label(bbox geometry,
|
|||||||
zoom_level integer)
|
zoom_level integer)
|
||||||
RETURNS TABLE
|
RETURNS TABLE
|
||||||
(
|
(
|
||||||
osm_id bigint,
|
id bigint,
|
||||||
geometry geometry,
|
geometry geometry,
|
||||||
name text,
|
name text,
|
||||||
name_en text,
|
name_en text,
|
||||||
@ -21,7 +21,7 @@ AS
|
|||||||
$$
|
$$
|
||||||
SELECT
|
SELECT
|
||||||
-- etldoc: osm_aerodrome_label_point -> layer_aerodrome_label:z10_
|
-- etldoc: osm_aerodrome_label_point -> layer_aerodrome_label:z10_
|
||||||
osm_id,
|
ABS(osm_id) AS id, -- mvt feature IDs can't be negative
|
||||||
geometry,
|
geometry,
|
||||||
name,
|
name,
|
||||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||||
|
|||||||
@ -38,10 +38,10 @@ layer:
|
|||||||
ele_ft: Elevation (`ele`) in feets.
|
ele_ft: Elevation (`ele`) in feets.
|
||||||
datasource:
|
datasource:
|
||||||
geometry_field: geometry
|
geometry_field: geometry
|
||||||
key_field: osm_id
|
key_field: id
|
||||||
key_field_as_attribute: no
|
key_field_as_attribute: no
|
||||||
srid: 900913
|
srid: 900913
|
||||||
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, iata, icao, ele, ele_ft FROM layer_aerodrome_label(!bbox!, z(!scale_denominator!))) AS t
|
query: (SELECT id, geometry, name, name_en, name_de, {name_languages}, class, iata, icao, ele, ele_ft FROM layer_aerodrome_label(!bbox!, z(!scale_denominator!))) AS t
|
||||||
schema:
|
schema:
|
||||||
- ./update_aerodrome_label_point.sql
|
- ./update_aerodrome_label_point.sql
|
||||||
- ./aerodrome_label.sql
|
- ./aerodrome_label.sql
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user