diff --git a/TESTS.md b/TESTS.md index 27ff8e9c4..c47a88e22 100644 --- a/TESTS.md +++ b/TESTS.md @@ -67,7 +67,7 @@ Fixture data should be loaded in each test that needs it; either once for the cl 1. `https://www.openstreetmap.org/...` to load OSM nodes, ways and relations. 2. `http://overpass-api.de/api/interpreter?data=...` to make a query against Overpass API. -3. `https://whosonfirst.mapzen.com/data/...` to load data from WhosOnFirst. +3. `https://data.whosonfirst.org/...` to load data from Who's On First. 4. `file://integration-test/fixtures/...` to load data from a bundled shapefile. This is useful to handle fixtures from Natural Earth data, or pre-packaged shapefiles from OpenStreetMapData. Additionally, optional arguments can be provided to `load_fixtures`: diff --git a/docs/attribution.md b/docs/attribution.md index 53b67cacb..e936dd0f0 100644 --- a/docs/attribution.md +++ b/docs/attribution.md @@ -66,10 +66,10 @@ More details can be found on the Natural Earth [Terms of Use](http://www.natural `source:whosonfirst` -Crediting [Who's On First](https://whosonfirst.mapzen.com) is recommended and linking back to their License is required. +Crediting [Who's On First](https://www.whosonfirst.org) is recommended and linking back to their License is required. ``` -Data from Who's On First. License +Data from Who's On First. License and sources. ``` Who's On First makes use of a number of open data sources, some of whom **do** require attribution. Neighbourhood sources include: [Zetashapes](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#zetashapes) (geometry), [Quattroshapes](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#quattroshapes) (geometry), and [GeoPlanet](https://github.com/whosonfirst/whosonfirst-data/blob/master/LICENSE.md#geoplanet) (names). Please note that original sources may be modified. diff --git a/docs/data-sources.md b/docs/data-sources.md index 7faef76fa..dc35264ea 100644 --- a/docs/data-sources.md +++ b/docs/data-sources.md @@ -45,4 +45,4 @@ More details can be found at: http://www.naturalearthdata.com/about/terms-of-use `source:whosonfirst` -[Who's On First](http://whosonfirst.mapzen.com) is Mapzen's place gazetteer, and is used to source neighbourhood labels. +[Who's On First](http://www.whosonfirst.org/) is an open place gazetteer initiated by Mapzen and is used to source neighbourhood labels. diff --git a/docs/layers.md b/docs/layers.md index 91c2a04c7..9415a930b 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -593,7 +593,7 @@ Places with `kind` values of `continent`, `country`, with others added starting ![image](images/mapzen-vector-tile-docs-places-neighbourhoods.png) -**Neighbourhoods:** [Who's On First](http://whosonfirst.mapzen.com) `neighbourhood` and `macrohood` features are added starting at zoom 12. Neighbourhoods are included one zoom earlier than their `min_zoom`, and stay included 1 zoom past their `max_zoom`. +**Neighbourhoods:** [Who's On First](http://www.whosonfirst.org/) `neighbourhood` and `macrohood` features are added starting at zoom 12. Neighbourhoods are included one zoom earlier than their `min_zoom`, and stay included 1 zoom past their `max_zoom`. #### Place properties (common): @@ -602,7 +602,7 @@ Places with `kind` values of `continent`, `country`, with others added starting * `id`: The `osm_id` from OpenStreetMap or Natural Earth id * `kind`: normalized values between OpenStreetMap and Natural Earth * `population`: population integer values from OpenStreetMap or Natural Earth's maximum population value. -* `source`: `openstreetmap`, `naturalearthdata.com`, or `whosonfirst.mapzen.com` +* `source`: `openstreetmap`, `naturalearthdata.com`, or `whosonfirst.org` * `min_zoom`: a suggested minimum zoom at which the place should become visible based on scalerank and population values from Natural Earth, and invented for OpenStreetMap. Note that this is not an integer, and may contain fractional parts. #### Place properties (common optional): diff --git a/integration-test/418-wof-l10n_name.py b/integration-test/418-wof-l10n_name.py index 44285cf32..e56afa020 100644 --- a/integration-test/418-wof-l10n_name.py +++ b/integration-test/418-wof-l10n_name.py @@ -5,26 +5,26 @@ class WofL10nName(FixtureTest): def test_hollywood(self): # Hollywood (wof neighbourhood) self.load_fixtures([ - 'https://whosonfirst.mapzen.com/data/858/260/37/85826037.geojson' + 'https://data.whosonfirst.org/858/260/37/85826037.geojson' ]) self.assert_has_feature( 16, 11227, 26157, 'places', {'id': 85826037, 'kind': 'neighbourhood', - 'source': "whosonfirst.mapzen.com", + 'source': "whosonfirst.org", 'name': 'Hollywood', 'name:ko': '\xed\x97\x90\xeb\xa6\xac\xec\x9a\xb0\xeb\x93\x9c'}) def test_san_francisco_wof(self): # San Francisco (wof neighbourhood) self.load_fixtures([ - 'https://whosonfirst.mapzen.com/data/858/826/41/85882641.geojson' + 'https://data.whosonfirst.org/858/826/41/85882641.geojson' ]) self.assert_has_feature( 16, 14893, 29234, 'places', {'id': 85882641, 'kind': 'neighbourhood', - 'source': "whosonfirst.mapzen.com", + 'source': "whosonfirst.org", 'name': 'San Francisco', 'name:es': 'San Francisco'}) diff --git a/integration-test/__init__.py b/integration-test/__init__.py index 8eefe16bb..970625271 100644 --- a/integration-test/__init__.py +++ b/integration-test/__init__.py @@ -295,7 +295,7 @@ def canonical_url(self): for d in digits: if d is not None: slashed += d - url = "https://whosonfirst.mapzen.com/data/%s/%d.geojson" \ + url = "https://data.whosonfirst.org/%s/%d.geojson" \ % (slashed, self.wof_id) return url @@ -665,23 +665,23 @@ def download(self, objs, target_file, clip, simplify): class WOFSource(object): def __init__(self): - self.hosts = ('whosonfirst.mapzen.com',) + self.hosts = ('data.whosonfirst.org',) def parse(self, url): - parts = url.path.split("/") - if len(parts) != 6: + parts = url.path.rsplit("/", 1) + if len(parts) != 2: raise Exception( - "Fixture shape URLs should look like: " - "https://whosonfirst.mapzen.com/data/858/260/37/" + "WOF fixture URLs should look like: " + "https://data.whosonfirst.org/858/260/37/" "85826037.geojson, not %r" % (url,)) - if parts[0] != "" or parts[1] != "data": - raise Exception("Malformed fixture shapefile URL") - id_str = "".join(parts[2:5]) - name = id_str + ".geojson" - if name != parts[5]: + prefix, filename = parts + if not prefix.startswith('/') or not filename.endswith('.geojson'): + raise Exception("Malformed fixture geojson URL") + id_str = prefix.replace('/', '') + if filename != (id_str + ".geojson"): raise Exception("Expected URL to be redundant, but %r doesn't " - "look like %r" % (parts[2:5], parts[5])) + "look like %r" % (prefix, filename)) return WOFDataObject(int(id_str)) @@ -702,7 +702,7 @@ def download(self, objs, target_file, clip, simplify): reproject_mercator_to_lnglat, n.label_position) properties = { - 'source': 'whosonfirst.mapzen.com', + 'source': 'whosonfirst.org', 'name': n.name, 'min_zoom': n.min_zoom, 'max_zoom': n.max_zoom, @@ -1613,6 +1613,9 @@ def flatten_tests(suite): parser.add_argument( '--regenerate', action='store_const', const=True, default=False, help='Always regenerate the fixture, even if it exists in the cache.') + parser.add_argument( + '--fail-fast', action='store_const', const=True, default=False, + help='Stop the test run on the first error or failure.') args = parser.parse_args() test_stdout = sys.stderr @@ -1654,7 +1657,8 @@ def flatten_tests(suite): suite = unittest.TestSuite() suite.addTests(tests) - runner = unittest.TextTestRunner(stream=test_stdout) + runner = unittest.TextTestRunner( + stream=test_stdout, failfast=args.fail_fast) result = runner.run(suite) if not result.wasSuccessful(): diff --git a/queries/wof.jinja2 b/queries/wof.jinja2 index 3dc4a7eea..2041e862c 100644 --- a/queries/wof.jinja2 +++ b/queries/wof.jinja2 @@ -7,7 +7,7 @@ SELECT COALESCE(to_jsonb(l10n_name), '{}'::jsonb) || jsonb_build_object( 'name', name, - 'source', 'whosonfirst.mapzen.com', + 'source', 'whosonfirst.org', 'mz_n_photos', n_photos, 'area', area, 'is_landuse_aoi', is_landuse_aoi, diff --git a/test/test_meta.py b/test/test_meta.py index 006638b7d..d5cd095c1 100644 --- a/test/test_meta.py +++ b/test/test_meta.py @@ -69,7 +69,7 @@ def _make_metadata(name): sources = { 'osm': Source('osm', 'openstreetmap.org'), 'ne': Source('ne', 'naturalearthdata.com'), - 'wof': Source('wof', 'whosonfirst.mapzen.com'), + 'wof': Source('wof', 'whosonfirst.org'), 'shp': Source('shp', 'openstreetmapdata.com'), } return make_metadata(sources[name]) diff --git a/test/test_transform.py b/test/test_transform.py index 3403c3bb6..eacb0939c 100644 --- a/test/test_transform.py +++ b/test/test_transform.py @@ -128,7 +128,7 @@ def test_osm_source(self): self.assertEquals('foo', props['name:en']) def test_wof_source(self): - shape, props, fid = self._call_fut('whosonfirst.mapzen.com', + shape, props, fid = self._call_fut('whosonfirst.org', 'eng_x', 'foo') self.assertTrue('name:en' in props) self.assertEquals('foo', props['name:en']) @@ -163,7 +163,7 @@ def _call_fut(self, source, kvs): def test_wof_no_two_letter_code(self): # given variants which have no 2-letter code (arq), then we should # just be left with the ones which do (ara). - shape, props, fid = self._call_fut('whosonfirst.mapzen.com', + shape, props, fid = self._call_fut('whosonfirst.org', {'ara': 'foo', 'arq': 'bar'}) self.assertTrue('name:ar' in props) self.assertFalse('name:ara' in props) diff --git a/vectordatasource/transform.py b/vectordatasource/transform.py index bc4485ffa..255630ae7 100644 --- a/vectordatasource/transform.py +++ b/vectordatasource/transform.py @@ -451,7 +451,7 @@ def tags_name_i18n(shape, properties, fid, zoom): return shape, properties, fid source = properties.get('source') - is_wof = source == 'whosonfirst.mapzen.com' + is_wof = source == 'whosonfirst.org' is_osm = source == 'openstreetmap.org' if is_osm: