mapbox_batch.py reads queries from an input text file, one per line, and constructs parallelized batch queries.
Results are stored in an output directory as JSON files.
- gevent 1.1a2 or later
- requests
- A Mapbox access token with batch geocoding capabilities (email [email protected])
pip install -r requirements.txt
Command line:
MapboxAccessToken=YOUR_ACCESS_TOKEN python mapbox_batch.py input_file.txt /path/to/output/directory
Programmatic:
from mapbox_batch import MapboxBatchGeocoder
mapbox = MapboxBatchGeocoder('YOUR_ACCESS_TOKEN')
with open('/path/to/input_file.txt') as input_file:
mapbox.geocode(input_file, '/path/to/output/directory/')