Skip to main content

Geographical queries made easy.

Project description

pygeons

https://img.shields.io/pypi/v/pygeons.svg https://img.shields.io/travis/mpenkov/pygeons.svg Documentation Status Updates

Geographical queries made simple.

>>> from pprint import pprint
>>> import pygeons
>>> # Scrub a (city, state, country) combination
>>> scrubbed = pygeons.csc_scrub('sydney', 'nsw', 'au')
>>> result = scrubbed.pop('result')
>>> scrubbed
{'score': 0.9, 'st_status': 'O', 'cc_status': 'O', 'count': 1}
>>> pprint(result)
{'_id': 2147714,
 'abbr': [],
 'admin1': 'State of New South Wales',
 'admin1names': ['new south wales', 'nsw', 'state of new south wales'],
 'admin2': '17200',
 'admin2names': [],
 'asciiname': 'Sydney',
 'countryCode': 'AU',
 'featureClass': 'P',
 'featureCode': 'PPLA',
 'latitude': -33.86785,
 'longitude': 151.20732,
 'name': 'Sydney',
 'names': ['syd', 'sydney', 'sydney city'],
 'names_lang': {'en': ['syd', 'sydney', 'sydney city']},
 'population': 4627345}
>>> pygeons.csc_scrub('sydney', 'nsw', None)['result']['_id']  # same GeoNames ID as above
2147714
>>> # Normalize a state abbreviation
>>> pygeons.norm('admin1', 'AU', 'nsw')
'State of New South Wales'
>>> # Translate a country name in the native language into English
>>> pygeons.country_info('россия')['names_lang']['en'][:4]
['ru', 'rus', 'russia', 'russian federation']

Features

  • Determine if a (city, state and country) combination corresponds to an existing place name

  • Scrub (city, state, country) combinations

  • Normalize city, state and country names to their canonical representations

  • Frame queries in English as well as languages native to each particular country

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.1 (2017-12-03)

  • First working release. Includes import scripts and source code.

0.1.0 (2017-11-26)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygeons-0.1.1.tar.gz (43.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page