Skip to content

Commit

Permalink
Merge pull request #2016 from tilezen/error_fixes
Browse files Browse the repository at this point in the history
Integration test error fixes
  • Loading branch information
jeffdefacto committed Dec 1, 2021
2 parents fca9c7d + bdebc4f commit cab179d
Show file tree
Hide file tree
Showing 36 changed files with 1,979 additions and 199 deletions.
38 changes: 35 additions & 3 deletions integration-test/1062-road-shield-cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,38 @@ def test_A52(self):
expected_shield_text='A52')

def test_M1(self):
self._check_network_relation(
way_id=3109799, rel_id=2332838, tile=(16, 32531, 21377),
expected_shield_text='M1')
import dsl
from shapely.wkt import loads as wkt_loads
z, x, y = 16, 32531, 21377
self.generate_fixtures(
dsl.way(3109799, dsl.tile_diagonal(z, x, y), {
"source": 'openstreetmap.org',
"lanes": "3",
"maxspeed:type": "UK:motorway",
"highways_england:area": "7",
"wikipedia": "en:M1 motorway",
"operator": "Highways England",
"ref": "M1",
"proposed:active_traffic_management": "yes",
"oneway": "yes",
"carriageway_ref": "A",
"highway": "motorway",
"int_ref": "E 13",
"lit": "yes",
"maxspeed": "70 mph"
}),
dsl.relation(2332838, {
"wikipedia": "en:European route E13",
"wikidata": "Q1247738",
"type": "route",
"route": "road",
"ref": "E 13",
"network": "e-road",
"e-road:class": "A-intermediate",
"description:fr": "E 13 Doncaster - Londres"
}, ways=[35568189]),
)

self.assert_has_feature(
z, x, y, 'roads',
{'id': 3109799, 'shield_text': 'M1'})
134 changes: 119 additions & 15 deletions integration-test/1170-very-early-paths-and-bike-routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,70 @@ class VeryEarlyPathsAndBikeRoutes(FixtureTest):
def test_path_with_international_route(self):
# highway=path, with route inter-national
# GR5-Grand Traverse de Jura between France and Switzerland
self.load_fixtures([
'https://www.openstreetmap.org/way/285975282',
'https://www.openstreetmap.org/relation/6009161',
], clip=self.tile_bbox(9, 265, 179))
# self.load_fixtures([
# 'https://www.openstreetmap.org/way/285975282',
# 'https://www.openstreetmap.org/relation/6009161',
# ], clip=self.tile_bbox(9, 265, 179))
import dsl
from shapely.wkt import loads as wkt_loads
self.generate_fixtures(
dsl.way(285975282, dsl.tile_diagonal(15, 17003, 11507), {
"highway": "footway",
"name": "GR5-Grand Traverse de Jura",
"source": "openstreetmap.org"
}),
dsl.relation(6009161, {
"name": "European long distance path E2 - Jura",
"name:fr": "Chemin de randonnée Européen E2 - Jura",
"name:nl": "Europese wandelroute E2, Jura",
"network": "iwn",
"operator": "European Ramblers Association",
"ref": "E2",
"route": "foot",
"type": "route",
"source": "openstreetmap.org"
}, ways=[285975282]),
)


self.assert_has_feature(
9, 265, 179, 'roads',
{'kind': 'path', 'walking_network': 'iwn'})

def test_path_with_national_route(self):
# highway=path, with route national (Pacific Crest Trail) at zoom 9
self.load_fixtures([
'https://www.openstreetmap.org/way/236361475',
'https://www.openstreetmap.org/relation/1225378',
], clip=self.tile_bbox(9, 86, 197))
# self.load_fixtures([
# 'https://www.openstreetmap.org/way/236361475',
# 'https://www.openstreetmap.org/relation/1225378',
# ], clip=self.tile_bbox(9, 86, 197))

import dsl
self.generate_fixtures(
dsl.way(236361475, dsl.tile_diagonal(9, 86, 197), {
"ref": "PCT Section H",
"source": "GPS",
"motorcar": "no",
"motorcycle": "no",
"foot": "designated",
"name": "Pacific Crest Trail",
"alt_name": "Pacific Crest National Scenic Trail",
"bicycle": "no",
"highway": "path",
"horse": "yes",
"network": "nwn",
"source": "openstreetmap.org"
}),
dsl.relation(1225378, {
"name": "Pacific Crest Trail",
"network": "nwn",
"ref": "PCT",
"route": "hiking",
"type": "route",
"wikidata": "Q2003736",
"wikipedia": "en:Pacific Crest Trail",
"source": "openstreetmap.org"
}, ways=[236361475]),
)

self.assert_has_feature(
9, 86, 197, 'roads',
Expand Down Expand Up @@ -87,13 +136,68 @@ def test_teriary_with_national_route(self):
def test_cycleway_with_international_route(self):
# Way: North Sea Cycle Route - part Netherlands (1977662)
# A really long highway=cycleway
self.load_fixtures([
'https://www.openstreetmap.org/way/35568189',
'https://www.openstreetmap.org/relation/1977662',
'https://www.openstreetmap.org/relation/1975739',
'https://www.openstreetmap.org/relation/5294',
'https://www.openstreetmap.org/relation/537418',
], clip=self.tile_bbox(8, 131, 83))
# self.load_fixtures([
# 'https://www.openstreetmap.org/way/35568189',
# 'https://www.openstreetmap.org/relation/1977662',
# 'https://www.openstreetmap.org/relation/1975739',
# 'https://www.openstreetmap.org/relation/5294',
# 'https://www.openstreetmap.org/relation/537418',
# ], clip=self.tile_bbox(8, 131, 83))
import dsl
from shapely.wkt import loads as wkt_loads
self.generate_fixtures(
dsl.way(35568189, dsl.tile_diagonal(13, 4211, 2670), {
'source': 'openstreetmap.org',
'bicycle': 'designated',
'foot': 'designated',
'highway': 'cycleway',
'surface': 'asphalt'
}),
dsl.relation(1977662, {
'source': 'openstreetmap.org',
'type': 'route',
'route': 'bicycle',
'alt_name': 'North Sea Cycle Route - part Netherlands',
'icn_ref': 'EV12',
'network': 'icn',
'ref': 'EV12',
'name': 'EuroVelo 12 - part Netherlands',
'name:de': 'EuroVelo 12 - Abschnitt Niederlande',
'name:en': 'North Sea Cycle Route - part Netherlands',
'name:pl': 'Szlak Rowerowy Morza Północnego - część Holandia',
'wikidata': 'Q456594',
}, ways=[35568189]),
dsl.relation(1975739, {
'source': 'openstreetmap.org',
'type': 'route',
'route': 'hiking',
'network': 'iwn',
'operator': 'European Ramblers Association',
'operator:nl': 'Wandelnet',
'ref': 'E9',
'name': 'Europese wandelroute E9, Nederland',
'name:de': 'Europäischer Fernwanderweg E9, Niederlande',
'name:en': 'European walking route E9 - part Netherlands',
'name:pl': 'Europejski długodystansowy szlak pieszy E9 - część Holandia',
'wikidata': 'Q1377728',
}, ways=[35568189]),
dsl.relation(5294, {
'source': 'openstreetmap.org',
'type': 'route',
'route': 'bicycle',
'network': 'ncn',
'ref': 'LF10',
'name': 'Waddenzeeroute',
}, ways=[35568189]),
dsl.relation(537418, {
'source': 'openstreetmap.org',
'type': 'route',
'route': 'bicycle',
'network': 'ncn',
'ref': 'LF21',
'name': 'Zuiderzeeroute',
}, ways=[35568189]),
)

self.assert_has_feature(
8, 131, 83, 'roads',
Expand Down
130 changes: 119 additions & 11 deletions integration-test/1194-bus-route-refs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from . import FixtureTest
import dsl
from shapely.wkt import loads as wkt_loads


class BusRouteRefs(FixtureTest):
Expand All @@ -7,10 +9,59 @@ def test_one_bus_route(self):
# type=route, route=bus, network="", ref=23
# type=route, route=bicycle, network=lcn, ref=50
# type=route, route=road, network=US:CA, ref=35
self.load_fixtures(['https://www.openstreetmap.org/way/417097119',
'https://www.openstreetmap.org/relation/3002741',
'https://www.openstreetmap.org/relation/32312',
'https://www.openstreetmap.org/relation/1976278'])
self.generate_fixtures(
dsl.way(417097119, dsl.tile_diagonal(16, 10469, 25340), {
'source': 'openstreetmap.org',
'cycleway:right': 'lane',
'hgv': 'designated',
'hgv:state_network': 'yes',
'highway': 'primary',
'lanes': '2',
'lcn_ref': '50',
'maxspeed': '35 mph',
'name': 'Sloat Boulevard',
'name:etymology:wikidata': 'Q634931',
'oneway': 'yes',
'ref': 'CA 35',
'sidewalk': 'right',
'source:hgv:state_network': 'Caltrans http://www.dot.ca.gov/hq/traffops/trucks/truckmap/',
'tiger:cfcc': 'A45',
'tiger:county': 'San Francisco, CA',
'tiger:name_base': 'Sloat',
'tiger:name_type': 'Blvd'
}),
dsl.relation(3002741, {
'source': 'openstreetmap.org',
'fee': 'yes',
'from': 'Palou Avenue & 3rd Street',
'name': 'Muni 23 outbound: Bayview => SF Zoo',
'operator': 'San Francisco Municipal Railway',
'payment:cash': 'yes',
'payment:clipper': 'yes',
'payment:prepaid_ticket': 'yes',
'public_transport:version': '2',
'ref': '23',
'route': 'bus',
'to': 'Great Highway & Sloat Boulevard',
'type': 'route'
}, ways=[417097119]),
dsl.relation(32312, {
'source': 'openstreetmap.org',
'cycle_network': 'US:CA:SF',
'network': 'lcn',
'ref': '50',
'route': 'bicycle',
'type': 'route'
}, ways=[417097119]),
dsl.relation(1976278, {
'source': 'openstreetmap.org',
'network': 'US:CA',
'ref': '35',
'route': 'road',
'type': 'route'
}, ways=[417097119]),
)


self.assert_has_feature(
16, 10469, 25340, 'roads',
Expand All @@ -26,9 +77,38 @@ def test_inbound_and_outbound_routes(self):
# Jackson St. SF, part of trolley-bus route 3
# relation 2980505 is outbound
# relation 2980504 is inbound
self.load_fixtures(['http://www.openstreetmap.org/way/225516711',
'http://www.openstreetmap.org/relation/2980505',
'http://www.openstreetmap.org/relation/2980504'])
self.generate_fixtures(
dsl.way(225516711, dsl.tile_diagonal(16, 10477, 25327), {
'source': 'openstreetmap.org',
'highway': 'residential',
'name': 'Jackson Street',
'name:etymology:wikidata': 'Q11817',
'sidewalk': 'both',
'tiger:cfcc': 'A41',
'tiger:county': 'San Francisco, CA',
'tiger:name_base': 'Jackson',
'tiger:name_type': 'St',
'trolley_wire': 'yes'
}),
dsl.relation(2980505, {
'source': 'openstreetmap.org',
'name': '3-Jackson: Outbound to The Richmond',
'ref': '3',
'route': 'trolleybus',
'type': 'route',
'from': 'Sutter St & Sansome St',
'to': 'Presidio Ave & California St'
}, ways=[225516711]),
dsl.relation(2980504, {
'source': 'openstreetmap.org',
'name': 'Muni 3 inbound: Pacific Heights => Downtown',
'ref': '3',
'route': 'trolleybus',
'type': 'route',
'to': 'Sutter St & Sansome St',
'from': 'Presidio Ave & California St'
}, ways=[225516711]),
)

self.assert_has_feature(
16, 10477, 25327, 'roads',
Expand All @@ -46,10 +126,38 @@ def test_full_lists_disappear_by_zoom_12(self):
# note that it doesn't matter what the bus shield is - that's
# data-dependent. for the purposes of the test, we only care that
# there _is_ one.
self.load_fixtures(['http://www.openstreetmap.org/way/225516711',
'http://www.openstreetmap.org/relation/2980505',
'http://www.openstreetmap.org/relation/2980504'])

self.generate_fixtures(
dsl.way(225516711, dsl.tile_diagonal(12, 654, 1583), {
'source': 'openstreetmap.org',
'highway': 'residential',
'name': 'Jackson Street',
'name:etymology:wikidata': 'Q11817',
'sidewalk': 'both',
'tiger:cfcc': 'A41',
'tiger:county': 'San Francisco, CA',
'tiger:name_base': 'Jackson',
'tiger:name_type': 'St',
'trolley_wire': 'yes'
}),
dsl.relation(2980505, {
'source': 'openstreetmap.org',
'name': '3-Jackson: Outbound to The Richmond',
'ref': '3',
'route': 'trolleybus',
'type': 'route',
'from': 'Sutter St & Sansome St',
'to': 'Presidio Ave & California St'
}, ways=[225516711]),
dsl.relation(2980504, {
'source': 'openstreetmap.org',
'name': 'Muni 3 inbound: Pacific Heights => Downtown',
'ref': '3',
'route': 'trolleybus',
'type': 'route',
'to': 'Sutter St & Sansome St',
'from': 'Presidio Ave & California St'
}, ways=[225516711]),
)
self.assert_has_feature(
10, 163, 395, 'roads',
{'bus_network': type(None),
Expand Down
24 changes: 21 additions & 3 deletions integration-test/1211-fix-null-network.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,30 @@

class FixNullNetwork(FixtureTest):
def test_routes_with_no_network(self):
import dsl
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# 'N4' (see #1062 regarding why it's 'N4' rather than '4').
self.load_fixtures(
['http://www.openstreetmap.org/relation/2307408'],
clip=self.tile_bbox(11, 1038, 705))

self.generate_fixtures(
dsl.way(69415104, dsl.tile_diagonal(11, 1038, 705), {
'source': 'openstreetmap.org',
'highway': 'primary',
'lanes': '3',
'maxspeed': '50',
'name': 'Avenue Roger Salengro',
'old_ref': 'N 4',
'ref': 'D 4',
'source:maxspeed': 'FR:urban',
'surface': 'asphalt'
}),
dsl.relation(2307408, {
'source': 'openstreetmap.org',
'ref': 'N 4',
'route': 'road',
'type': 'route'
}, ways=[69415104]),
)

self.assert_has_feature(
11, 1038, 705, 'roads',
Expand Down
Loading

0 comments on commit cab179d

Please sign in to comment.