-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.1.0: Initial, unoptimized release
This has been measured geocoding about 1,850 addresses/second on a laptop with a fiber connection.
- Loading branch information
Showing
3 changed files
with
71 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "streaming-geocode" | ||
name = "geocode-csv" | ||
version = "0.1.0" | ||
authors = ["Eric Kidd <[email protected]>"] | ||
edition = "2018" | ||
|
@@ -9,7 +9,6 @@ common_failures = "0.1.1" | |
csv = "1.0.7" | ||
env_logger = "0.6.1" | ||
failure = "0.1.5" | ||
futures-cpupool = "0.1.8" | ||
futures-preview = { version = "0.3.0-alpha", features = ["compat"] } | ||
hyper = "0.12" | ||
hyper-tls = "0.3" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# `geocode-csv`: Geocode a CSV file using the SmartyStreets API | ||
|
||
(This project is not associated with [SmartyStreets][].) | ||
|
||
**WARNING: This project geocodes CSV files thousands of rows per second, which can use up your SmartyStreets quota very quickly.** This may cost you money. | ||
|
||
If you have a CSV file that appears as follows: | ||
|
||
```csv | ||
name,street1,street2,city,state,zip | ||
Resident,1600 Pennsylvania Avenue NW,,Washington DC,20500 | ||
``` | ||
|
||
...and an `address_spec.json` file that appears as follows: | ||
|
||
```json | ||
{ | ||
"geocoded": { | ||
"street": ["street1", "street2"], | ||
"city": "city", | ||
"state": "state", | ||
"zipcode": "zip" | ||
} | ||
} | ||
``` | ||
|
||
...then you can geocode it using: | ||
|
||
```sh | ||
# Set up credentials. | ||
export SMARTYSTREETS_AUTH_ID=... | ||
export SMARTYSTREETS_AUTH_TOKEN=... | ||
|
||
# Geocode the CSV. | ||
geocode-csv --spec address_spec.json < in.csv > out.csv | ||
``` | ||
|
||
This will add a series of columns starting with `geocoded_`, which will contain various postal delivery information, plus estimated latitude and longitude. If geocoding succeeds, `geocode-csv` will return 0. If it fails, it will return a non-zero error code and print a human-readable error message to standard error. | ||
|
||
You can geocode multiple addresses per row as follows: | ||
|
||
```json | ||
{ | ||
"geocoded_shipping": { /* ... */ }, | ||
"geocoded_billing": { /* ... */ } | ||
} | ||
``` | ||
|
||
This will insert two sets of columns, one beginning with `geocoded_shipping_` and the other with `geocoded_billing_`. | ||
|
||
[SmartyStreets]: https://smartystreets.com/ |