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

Add min_zoom = 17 for generated address points #2032

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
136 changes: 136 additions & 0 deletions integration-test/2032-building-address-points-missing-min-zooms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# -*- encoding: utf-8 -*-
import dsl

from . import FixtureTest


class BuildingAddressPointsMissingMinZooms(FixtureTest):

def test_address_point_gen_has_min_zoom_17(self):
import dsl

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

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
dsl.way(265302092, dsl.tile_box(z, x, y), {
'addr:city': 'New York',
'addr:housenumber': '1071',
'addr:postcode': '10018',
'addr:street': '6th Avenue',
'building': 'yes',
'building:colour': '#86816E',
'building:levels': '12',
'height': '46.6',
'name': '1071 Sixth Avenue',
'nycdoitt:bin': '1022566',
'roof:material': 'concrete',
'roof:shape': 'flat',
'source': 'openstreetmap.org',
'start_date': '1920',
}),
)

self.assert_has_feature(
z, x, y, 'buildings', {
'id': 265302092,
'addr_housenumber': '1071',
'kind': 'address',
'min_zoom': 17
})

# at zoom 15, there should be no address points generated
def test_no_address_points_generated_below_zoom_16(self):
import dsl

z, x, y = (15, 9649, 12315)

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
dsl.way(265302092, dsl.tile_box(z, x, y), {
'addr:city': 'New York',
'addr:housenumber': '1071',
'addr:postcode': '10018',
'addr:street': '6th Avenue',
'building': 'yes',
'building:colour': '#86816E',
'building:levels': '12',
'height': '46.6',
'name': '1071 Sixth Avenue',
'nycdoitt:bin': '1022566',
'roof:material': 'concrete',
'roof:shape': 'flat',
'source': 'openstreetmap.org',
'start_date': '1920',
}),
)

self.assert_no_matching_feature(
z, x, y, 'buildings', {
'kind': 'address',
})

# if there is no housenumber, and the building name is just a number, use that
def test_address_point_falls_back_to_name(self):
import dsl

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

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
dsl.way(265302092, dsl.tile_box(z, x, y), {
'addr:city': 'New York',
# omitted 'addr:housenumber': '1071',
'addr:postcode': '10018',
'addr:street': '6th Avenue',
'building': 'yes',
'building:colour': '#86816E',
'building:levels': '12',
'height': '46.6',
'name': '999', # modified to be a number
'nycdoitt:bin': '1022566',
'roof:material': 'concrete',
'roof:shape': 'flat',
'source': 'openstreetmap.org',
'start_date': '1920',
}),
)

self.assert_has_feature(
z, x, y, 'buildings', {
'id': 265302092,
'addr_housenumber': '999',
'kind': 'address',
'min_zoom': 17
})

# if there is no housenumber, and the building name is not just a number, don't make an address point
def test_no_address_point_if_no_usable_address(self):
import dsl

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

self.generate_fixtures(
# https://www.openstreetmap.org/way/265302092
dsl.way(265302092, dsl.tile_box(z, x, y), {
'addr:city': 'New York',
# omitted 'addr:housenumber': '1071',
'addr:postcode': '10018',
'addr:street': '6th Avenue',
'building': 'yes',
'building:colour': '#86816E',
'building:levels': '12',
'height': '46.6',
'name': '1071 Sixth Avenue',
'nycdoitt:bin': '1022566',
'roof:material': 'concrete',
'roof:shape': 'flat',
'source': 'openstreetmap.org',
'start_date': '1920',
}),
)

self.assert_no_matching_feature(
z, x, y, 'buildings', {
'kind': 'address',
})
1 change: 1 addition & 0 deletions vectordatasource/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,7 @@ def generate_address_points(ctx):
# address points.
label_properties = dict(
addr_housenumber=addr_housenumber,
min_zoom=17,
kind='address')

source = properties.get('source')
Expand Down