Skip to content
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

buildings layer thining on z14 to z15 #2052

Merged
merged 22 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions integration-test/1732-restore-building-scale-rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,3 @@ def test_tiny_shed_z17(self):
'kind': 'building',
'min_zoom': 17,
}, 1)

def test_slightly_larger_outbuilding_z16(self):
# check that a small building (or large shed), assigned zoom 16 in the
# buildings.yaml, doesn't get re-assigned a lower zoom. it should stay
# at z16.
z, x, y = (16, 0, 0)

# make one 4x4m building.
self._setup_row(z, x, y, 4, 4, 1)

self.assert_n_matching_features(
z, x, y, 'buildings', {
'kind': 'building',
'min_zoom': 16,
}, 1)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BuildingAddressPointsMissingMinZooms(FixtureTest):
def test_address_point_gen_has_min_zoom_17(self):
import dsl

z, x, y = (16, 19299, 24630)
z, x, y = (17, 19299, 24630)

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_no_address_points_generated_below_zoom_16(self):
def test_address_point_falls_back_to_name(self):
import dsl

z, x, y = (16, 19299, 24630)
z, x, y = (17, 19299, 24630)

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
Expand Down
3 changes: 2 additions & 1 deletion integration-test/806-building-height.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def test_from_building_levels(self):
self.generate_fixtures(dsl.way(431358377, wkt_loads('POLYGON ((127.055528903431 37.25885030044089, 127.056004112216 37.2594416554027, 127.05683658099 37.2590179623059, 127.056361372205 37.25842660401769, 127.055528903431 37.25885030044089))'), {
u'building': u'office', u'building:levels': u'25', u'way_area': u'10799.6', u'name': u'R5 Tower A', u'source': u'openstreetmap.org'}))

# the height is processed quantize_height_round_nearest_5_meters from 77.0 to 75.0 introduced at https://github.com/tilezen/vector-datasource/pull/2052/
self.assert_has_feature(
16, 55897, 25449, 'buildings',
{'id': 431358377, 'height': 77.0, 'kind': 'building',
{'id': 431358377, 'height': 75.0, 'kind': 'building',
'building:levels': type(None), 'building_levels': type(None)})

def test_min_height_from_min_levels(self):
Expand Down
63 changes: 58 additions & 5 deletions queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1712,19 +1712,20 @@ post_process:
# drop small inners in buildings before we do the merge.
- fn: vectordatasource.transform.drop_small_inners
params:
end_zoom: 15
end_zoom: 17
source_layers: [buildings]
pixel_area: 0.25
pixel_area: 10.0
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

- fn: vectordatasource.transform.quantize_height
params:
source_layer: buildings
start_zoom: 13
end_zoom: 16
end_zoom: 17
quantize:
13: vectordatasource.transform.quantize_height_round_nearest_20_meters
14: vectordatasource.transform.quantize_height_round_nearest_10_meters
15: vectordatasource.transform.quantize_height_round_nearest_10_meters
16: vectordatasource.transform.quantize_height_round_nearest_5_meters
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

# assign `scale_rank` - BEFORE merging, as we want to assign this based on
# the original area/height/volume of the building before it is possibly
Expand All @@ -1740,6 +1741,58 @@ post_process:
source_layer: buildings
target_value_type: int

- fn: vectordatasource.transform.drop_properties
params:
source_layer: buildings
start_zoom: 0
end_zoom: 17
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
properties:
- landuse_kind
where: >-
landuse_kind not in ['aerodrome', 'airfield', 'cemetery', 'college', 'conservation', 'forest', 'garden', 'golf_course', 'hospital', 'national_park', 'nature_reserve', 'park', 'protected_area', 'runway', 'school', 'taxiway', 'university']
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

- fn: vectordatasource.transform.drop_properties
params:
source_layer: buildings
start_zoom: 0
end_zoom: 16
properties:
- kind_detail
where: >-
kind_detail not in ['airport', 'civic', 'church', 'college', 'commercial', 'fire_station', 'industrial', 'military', 'hospital', 'office', 'public', 'prison', 'retail', 'school', 'sports_centre', 'stadium', 'station', 'synagogue', 'train_station', 'university', 'warehouse']
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

- fn: vectordatasource.transform.drop_properties
params:
source_layer: buildings
start_zoom: 0
end_zoom: 16
properties:
- building_material
- layer
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
- location
- osm_relation
- roof_color
- roof_height
- roof_material
- roof_orientation
- roof_shape
- root_id
- volume

- fn: vectordatasource.transform.drop_properties
params:
source_layer: buildings
start_zoom: 0
end_zoom: 17
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
# short-hand for "name" property in the list below means all name-like
# properties.
all_name_variants: true
properties:
- name
- old_name
- addr_housenumber
- addr_street

# fit min zoom onto the scale rank, as we'll be using the scale rank rather
# than the min zoom to calculate whether a building should make it into a
# tile. having them split separately means we can't merge them together.
Expand Down Expand Up @@ -1779,9 +1832,9 @@ post_process:
# process may also have created small inners.
- fn: vectordatasource.transform.drop_small_inners
params:
end_zoom: 15
end_zoom: 17
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
source_layers: [buildings]
pixel_area: 0.25
pixel_area: 10.0
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

- fn: vectordatasource.transform.numeric_min_filter
params:
Expand Down
8 changes: 6 additions & 2 deletions yaml/buildings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ globals:
way_area: { min: 500 }
volume: { min: 50000 }
- &z15_area_volume
way_area: { min: 20 }
any:
way_area: { min: 50 }
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
volume: { min: 20000 }
- &z16_area_volume
way_area: { min: 10 }
any:
way_area: { min: 30 }
volume: { min: 8000 }
# synthetic columns are values available to filters and output, but which are
# generated in the SQL function and not passed in from the tables. in this case,
# we generate the volume from the building height and way_area, where available.
Expand Down