-
-
Notifications
You must be signed in to change notification settings - Fork 3
Update locale attribute names for Diplomat locale-based labels #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
9e8ffd0
672b7fa
8b07a76
d82cfc3
12dca09
fab2c54
099744c
087fe29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| { | ||
| "tags": { | ||
| "load_all": true, | ||
| "exclude": [ | ||
| "created_by", | ||
| "source", | ||
| "source:datetime" | ||
| ] | ||
| }, | ||
| "generalized_tables": {}, | ||
| "tables": { | ||
| "water_multilines": { | ||
| "type": "relation_member", | ||
| "fields": [ | ||
| { | ||
| "type": "id", | ||
| "name": "osm_id", | ||
| "key": null | ||
| }, | ||
| { | ||
| "type": "geometry", | ||
| "name": "geometry", | ||
| "key": null | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "name", | ||
| "key": "name" | ||
| }, | ||
| { | ||
| "type": "mapping_value", | ||
| "name": "type", | ||
| "key": null | ||
| }, | ||
| { | ||
| "type": "mapping_key", | ||
| "name": "class", | ||
| "key": null | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "bridge", | ||
| "key": "bridge" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "start_date", | ||
| "key": "start_date" | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "end_date", | ||
| "key": "end_date" | ||
| }, | ||
| { | ||
| "type": "hstore_tags", | ||
| "name": "tags", | ||
| "key": null | ||
| }, | ||
| { | ||
| "type": "member_id", | ||
| "name": "member" | ||
| }, | ||
| { | ||
| "type": "hstore_tags", | ||
| "name": "me_tags", | ||
| "from_member": true | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "me_name", | ||
| "key": "name", | ||
| "from_member": true | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "name": "me_waterway", | ||
| "key": "waterway", | ||
| "from_member": true | ||
| } | ||
| ], | ||
| "mapping": { | ||
| "type": [ | ||
| "waterway" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,61 +1,77 @@ | ||
| -- ============================================================================ | ||
| -- Prepare points materialized view for higher zoom levels (12+) | ||
| -- Add height and height_fixed columns | ||
| -- All building/roof attributes (height, building:height, building:material, etc.) | ||
| -- are now extracted as native columns by imposm in osm_buildings_points | ||
| -- ============================================================================ | ||
| -- 3D / rendering attributes (height, materials, colours, levels, parts, roof | ||
| -- shape) are only meaningful on polygon footprints. Points (building=* | ||
| -- nodes) keep just identity/classification fields (name, type, building_use, | ||
| -- addresses). Inject NULLs of matching types so the UNION with polygon | ||
| -- centroids in mv_buildings_points_centroids_* aligns by name and type. | ||
| SELECT create_points_mview( | ||
| 'osm_buildings_points', | ||
| 'mv_buildings_points', | ||
| 'id, source, osm_id', | ||
| ARRAY['NULL as height'], | ||
| ARRAY[ | ||
| 'NULL::double precision AS height', | ||
| 'NULL::double precision AS min_height', | ||
| 'NULL::double precision AS building_height', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 'NULL::double precision AS roof_height', | ||
| 'NULL::text AS building_min_level', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 'NULL::text AS building_material', | ||
| 'NULL::text AS building_levels', | ||
| 'NULL::text AS building_colour', | ||
| 'NULL::text AS building_part', | ||
| 'NULL::text AS roof_material', | ||
| 'NULL::text AS roof_colour', | ||
| 'NULL::text AS roof_shape' | ||
| ], | ||
| NULL | ||
| ); | ||
|
|
||
|
|
||
|
|
||
| -- ============================================================================ | ||
| -- Zoom 14-15: | ||
| -- Very low simplification (5m) | ||
| -- Very small areas (>5K m² = 0.005 km²) | ||
| -- Add height_fixed column | ||
| -- Zoom 16-20: BASE | ||
| -- No simplification, all areas. Single point where height/building_height/ | ||
| -- roof_height are parsed to numeric. All derived zoom levels inherit this. | ||
| -- ============================================================================ | ||
| SELECT create_areas_mview( | ||
| 'osm_buildings', | ||
| 'mv_buildings_areas_z14_15', | ||
| 5, | ||
| 5000, | ||
| 'mv_buildings_areas_z16_20', | ||
| 0, | ||
| 0, | ||
| 'id, osm_id, type', | ||
| NULL, | ||
| NULL, | ||
| NULL | ||
| '{"height": "parse_to_meters(height)", "min_height": "parse_to_meters(min_height)", "building_height": "parse_to_meters(building_height)", "roof_height": "parse_to_meters(roof_height)"}'::jsonb | ||
| ); | ||
|
|
||
| SELECT create_points_centroids_mview( | ||
| 'mv_buildings_areas_z14_15', | ||
| 'mv_buildings_points_centroids_z14_15', | ||
| 'mv_buildings_points' | ||
| ); | ||
| -- ============================================================================ | ||
| -- Zoom 16-20: | ||
| -- No simplification | ||
| -- All areas | ||
| -- Add height_fixed column | ||
| -- Zoom 14-15: derived from z16_20 | ||
| -- Low simplification (5m), filters out small buildings (<5,000 m²) | ||
| -- ============================================================================ | ||
|
|
||
| SELECT create_areas_mview( | ||
| 'osm_buildings', | ||
| SELECT create_area_mview_from_mview( | ||
| 'mv_buildings_areas_z16_20', | ||
| 0, | ||
| 0, | ||
| 'id, osm_id, type', | ||
| NULL, | ||
| NULL, | ||
| 'mv_buildings_areas_z14_15', | ||
| 5, | ||
| 5000, | ||
| NULL | ||
| ); | ||
|
|
||
| -- ============================================================================ | ||
| -- Centroids per zoom level (UNION with point-tagged buildings) | ||
| -- ============================================================================ | ||
| SELECT create_points_centroids_mview( | ||
| 'mv_buildings_areas_z16_20', | ||
| 'mv_buildings_points_centroids_z16_20', | ||
| 'mv_buildings_points' | ||
| ); | ||
| SELECT create_points_centroids_mview( | ||
| 'mv_buildings_areas_z14_15', | ||
| 'mv_buildings_points_centroids_z14_15', | ||
| 'mv_buildings_points' | ||
| ); | ||
|
|
||
| -- Refresh areas views | ||
| -- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_buildings_areas_z14_15; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,58 @@ END; | |
| $$ STRICT | ||
| LANGUAGE plpgsql IMMUTABLE; | ||
|
|
||
| -- Parse free-form OSM height-like values (height=*, min_height=*, roof:height=*, | ||
| -- building:height=*) to meters as double precision. | ||
| -- | ||
| -- Accepts (per https://wiki.openstreetmap.org/wiki/Key:height): | ||
| -- "20", "20.5" -> meters (OSM default unit) | ||
| -- "20 m", "20m" -> meters with explicit unit | ||
| -- "20 meter", "20 meters" | ||
| -- "85'", "85 ft" -> feet -> meters | ||
| -- "8'5\"", "8'5" -> feet + inches -> meters | ||
| -- | ||
| -- Returns NULL for null/empty/unparseable input or for non-positive / out-of-range | ||
| -- values (<=0 or >1000m). NULLs are stripped from MVT properties, so consumers | ||
| -- can use ["coalesce", ["get","height"], <fallback>] safely. Why: a 0 is a real | ||
| -- numeric in MVT and would short-circuit coalesce, rendering 3D extrusions flat. | ||
| CREATE OR REPLACE FUNCTION parse_to_meters(input text) RETURNS double precision AS $$ | ||
| DECLARE | ||
| s text; | ||
| ft numeric; | ||
| inch numeric; | ||
| m text; | ||
| result double precision; | ||
| BEGIN | ||
| s := trim(input); | ||
| IF s = '' THEN | ||
| RETURN NULL; | ||
| END IF; | ||
|
|
||
| -- feet + optional inches: 8'5" / 8'5 / 8' | ||
| IF s ~ '^\d+(\.\d+)?''(\s*\d+(\.\d+)?"?)?$' THEN | ||
| ft := (regexp_match(s, '^(\d+(\.\d+)?)'''))[1]::numeric; | ||
| inch := COALESCE((regexp_match(s, '''\s*(\d+(\.\d+)?)"?$'))[1], '0')::numeric; | ||
| result := (ft * 0.3048) + (inch * 0.0254); | ||
| -- feet with ft suffix: 85ft / 85 ft / 85.5 ft | ||
| ELSIF s ~* '^\d+(\.\d+)?\s*ft$' THEN | ||
| ft := regexp_replace(s, '\s*ft$', '', 'i')::numeric; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unit symbols are case-sensitive.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation discourages |
||
| result := ft * 0.3048; | ||
| -- meters (default or explicit): 20 / 20.5 / 20 m / 20m / 20 meters | ||
| ELSIF s ~* '^-?\d+(\.\d+)?\s*(m|meter|meters)?$' THEN | ||
| m := regexp_replace(s, '\s*(m|meter|meters)\s*$', '', 'i'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| result := m::double precision; | ||
| ELSE | ||
| RETURN NULL; | ||
| END IF; | ||
|
|
||
| IF result <= 0 OR result > 1000 THEN | ||
| RETURN NULL; | ||
| END IF; | ||
| RETURN result; | ||
| EXCEPTION WHEN others THEN | ||
| RETURN NULL; | ||
| END; | ||
| $$ STRICT | ||
| LANGUAGE plpgsql IMMUTABLE; | ||
|
|
||
| COMMIT; | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike all the other keys,
building:part=*does not requirebuilding=*. It represents a different kind of feature. For example, this dome doesn’t appear in the staging tiles. We can include building parts in thebuildingslayer for convenience, rather than a separate layer as suggested in OpenHistoricalMap/issues#1370, but we’d need a boolean attribute indicating that it’s a building part.In other tile schemas that expose building parts, a building outline has an attribute that tells the stylesheet not to extrude it in 3D. This attribute would appear on any
building=*area that contains building parts or that has the roleoutlinein a building relation. Without this attribute, the extruded building outline would obscure any building parts within it.