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

Update to use new WOF domain #1489

Merged
merged 8 commits into from
Apr 20, 2018
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
2 changes: 1 addition & 1 deletion TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
4 changes: 2 additions & 2 deletions docs/attribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. <a href="https://whosonfirst.mapzen.com#License">License</a>
Data from Who's On First. <a href="https://www.whosonfirst.org/docs/licenses/">License</a> and <a href="https://github.com/whosonfirst/whosonfirst-sources/blob/master/sources/README.md">sources</a>.
```

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.
2 changes: 1 addition & 1 deletion docs/data-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions docs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions integration-test/418-wof-l10n_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'})

Expand Down
32 changes: 18 additions & 14 deletions integration-test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion queries/wof.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions test/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vectordatasource/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down