Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MuckRock/geocode
Geocode agency addresses
https://github.com/MuckRock/geocode
Last synced: 28 days ago
JSON representation
Geocode agency addresses
- Host: GitHub
- URL: https://github.com/MuckRock/geocode
- Owner: MuckRock
- Created: 2016-06-09T21:39:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-09T21:48:55.000Z (over 8 years ago)
- Last Synced: 2024-08-13T03:06:12.012Z (5 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Geocode
A small tool to geocode the addresses of agencies in the MuckRock database.
Uses the API to collect a group of agencies, then for each agency it:- cleans the existing address
- tags the address using the `usaddress` module
- rewrites the address using the individual tags
- geocodes the rewritten address by using an external geocoding serviceThen, using this data it:
- writes the agency data to a `.json` file for debugging or other processing
- patches each agency in the MuckRock API with the geocoded locationThis script currently requires a MuckRock account.
An account can be created on the MuckRock website.The script will ask you to login each time it's run, unless your MuckRock API token exists in your environment.
To set that up, run `python muckrock.py` to authenticate and get instructions on adding your token to your environment.The current external geocoding service is the OSM Nominatim, since it returned the best results.
To use a different geocoder, replace the URL and the query arguments in the `geocode.geocode_address` method.To run the geocode script on all federal agencies, run `python geocode.py`.
To run the goecode script on a different subset of agencies, provide different params to the `muckrock.agencies` method.
For example, to limit the geocoding to just approved federal agencies, supply the parameter `{'jurisdiction': 10, 'status': 'approved'}`.## Install and Run
1. `pip install -r requirements.txt`
2. `python geocode.py`