Skip to main content

Python-Geoclient

Call the RESTful NYC Geoclient API using python.

Python 2.7 | 3.4+ Build Status PyPI version

Introduction

This library provides a Python interface for using the NYC Geoclient API. It is an updated and maintained fork of nyc_geoclient.

In order to use the library, you must first register an application with the NYC Developer Portal to obtain an application key and ID.

Installing

you can install python-geoclient using:

$ pip install python-geoclient

or you can clone this directory and:

$ python setup.py install

Quickstart

Once your app has been registered with DoITT, using the API is simple:

from geoclient import Geoclient
g = Geoclient('my app ID', 'my app key')

You can use any of the available methods documented in the API:

g.address(100, 'Gold st', 'MN')

{u'uspsPreferredCityName': u'NEW YORK',
 u'fireCompanyType': u'E',
 u'fromLionNodeId': u'0015445',
 u'cooperativeIdNumber': u'0000',
 u'dotStreetLightContractorArea': u'1',
 u'lionBoroughCodeForVanityAddress': u'1',
 u'zipCode': u'10038',
 u'fireCompanyNumber': u'006',
 u'communityDistrict': u'101',
 u'firstStreetNameNormalized': u'GOLD STREET',
 u'boroughCode1In': u'1',
 u'latitude': 40.71035225065372,
 u'longitude': -74.00400739046181,
 ...
 }

Geocoding Errors

python-geoclient will raise a GeoclientError when the Geoclient API returns an error code. Sometimes there is more information returned, in which case the exception will have a result dictionary.

from geoclient import GeoclientError
try:
    g.address(125, 'wort st', 1)
except GeoclientError as e:
    print(e) # 'WORT STREET' NOT RECOGNIZED. THERE ARE 010 SIMILAR NAMES.
    print(e.result['streetName1']) # WORTH SQUARE

Documentation

The Python Geoclient documentation details using the library.

The API closely follows the DoITT documentation (requires account/login).

Running Tests

python setup.py test

Contributing

If you see an issue or would like to contribute, pull requests are welcome.

License

BSD.

Metadata

Release files for python-geoclient 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-geoclient 0.1.1
File Size Uploaded Provenance Actions
python-geoclient-0.1.1.tar.gz 7.2 kB Without provenance Details for python-geoclient-0.1.1.tar.gz

Release files / python-geoclient-0.1.1.tar.gz

Download URL python-geoclient-0.1.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ed3d8e462e9e269b4659433efc429b3033da9f951f3c31c5ec53cfda1352c85a
BLAKE2b-256 checksum
How to use checksums
d6875feabe8b166b610cc9e09b2f777070dc03378472e1d701dd81e80cda266f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Security for python-geoclient 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page