aepyornis / python-geosupport

Python bindings for NYC Geosupport Desktop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python-geosupport

A Python library for geocoding with NYC Planning's Geosupport Desktop Edition. Developed using version 17C of Geosupport Desktop Edition.

Getting Started

Prerequisites

Install Geosupport Desktop Edition:

Windows users: Ensure you select the correct Geosupport installation that corresponds to the Python interpreter you are using. Ex., Python 32-bit will only work with Geosupport 32-bit.

Additionally, you should check that the following environmental variables are set:

  • GEOFILES = the fls directory of your Geosupport installation. (ex. C:\Program Files (x86)\Geosupport Desktop Edition\fls\)
  • The Geosupport bin directory is in the PATH. (ex. C:\Program Files (x86)\Geosupport Desktop Edition\bin)

Linux users: Extract the .zip to a folder of your choice and set the GEOFILES and LD_LIBRARY_PATH environmental variables of the fls and lib directories like so:

$ export GEOFILES=/var/geosupport/version-17c/fls
$ export LD_LIBRARY_PATH=/var/geosupport/version-17c/lib/

How to use

  1. Install via pip:

    pip install python-geosupport
  2. Import the library and create an instance:

    from geosupport import Geocode
    
    g = Geocode()
  3. Geocode with:

    Single input street address

    result = g.address(address="125 Worth st, NY, NY")

    Parsed street address (Must provide zip code or borough)

    result = g.address(house_number="125", street="Worth st", zip=10013)
    
    result = g.address(house_number="125", street="Worth st", boro='MANHATTAN')

    Borough, Block, and Lot

    result = g.bbl(boro='1', block='00168', lot='0032')

    BIN

    result = g.bin(bin='1001831')

    Placename

    result = g.place(place='VAN CRTLANDT MANSION', boro='bronx')

    Intersection

    result = g.intersection(street_1='ST NICHOLAS AVENUE', street_2='MENAHAN STREET', boro='QUEENS')

    Street Segment

    result = g.street_segment(on_street='STORY AVENUE',
                              cross_street_1='EVERGREEN AVENUE',
                              cross_street_2='WHEELER AVENUE',
                              boro='BRONX')

    Blockface

    result = g.blockface(on_street='STORY AVENUE',
                         cross_street_1='EVERGREEN AVENUE',
                         cross_street_2='WHEELER AVENUE',
                         boro='BRONX',
                         compass_direction='N')

    Street Stretch

    result = g.street_stretch(on_street='CLIFTON PLACE',
                              cross_street_1='SAINT JAMES PLACE',
                              cross_street_2='GRAND AVENUE',
                              boro='BK',
                              compass_direction='N',
                              compass_direction_2='S')

    *The boro argument can be borough code, borough name or a common borough abbreviation.

Running tests

>> python setup.py test

Known Issues

  • Single address inputs containing Grand Concourse are not parsed correctly if they do not contain NY or New York in the string.
  • Single address inputs with a space instead of a hyphen are not parsed correctly. Ex. 180 05 HILLSIDE AVE, QUEENS, 11432

TODO

  • Improve single address input parsing
  • Better data with compass direction for testing blockface and street_stretch methods.

License

This project is licensed under the MIT License - see the license.txt file for details

Acknowledgments

About

Python bindings for NYC Geosupport Desktop

License:MIT License


Languages

Language:Python 100.0%