Python script for batch geocoding using NYC Planning Labs' Geosearch API
- Create a folder on your computer where you save the python script for your version of Python. Use
geosearch_2.py
if you're using Python 2. Alternatively, usegeosearch_3.py
if you're using Python 3. - Place the ungeocoded data csv file in the same folder as the python script.
- Open your data csv to identify which column #s are relevant for the geocoding script. Begin counting from zero.
- Update the column numbers for the house number, street name, and borough columns in the python script on lines 10-14.
- Via the command line, navigate inside the folder.
- Run the script by running
python geosearch_v.py input.csv output.csv
in the command line, filling in the appropriate vairables:_v
version for your Python version- input csv file name
- preferred output file name
If the script is running correctly, you will see it printing the results in the terminal for each row it iterates through.