Python tools for working with place names in Who's On First data
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mapzen
.gitignore
LICENSE
README.md
VERSION
requirements.txt
setup.py

README.md

py-mapzen-whosonfirst-names

Python tools for working with place names in Who's On First data

Install

sudo pip install -r requirements.txt .

Important

Note that as of this writing the naming conventions for wof data are not reflected in the whosonfirst-data repository.

Usage

mapzen.whosonfirst.names.labels

import mapzen.whosonfirst.names

lbl = mapzen.whosonfirst.names.labels()
names = ("fin_p", "eng_s", "unk_v")

for n in names:
	print n

	n2 = lbl.convert(n, 'geoplanet', 'wof')
	print n2

	n3 = lbl.convert(n2, 'wof', 'subtags')
	print n3

	n4 = lbl.convert(n3, 'subtags', 'wof')
	print n4

	n5 = lbl.convert(n4, 'wof', 'geoplanet')
	print n5

Would yield:

fin_p
fin_x_prefered
fin-x-prefered
fin_x_prefered
fin_p
eng_s
eng_x_colloquial
eng-x-colloquial
eng_x_colloquial
eng_s
unk_v
und_x_variant
und-x-variant
und_x_variant
unk_v

See also