https://github.com/abrie/us-census-geocoder
Go module and CLI interface to the Census.gov Geocoder REST API.
https://github.com/abrie/us-census-geocoder
Last synced: 3 months ago
JSON representation
Go module and CLI interface to the Census.gov Geocoder REST API.
- Host: GitHub
- URL: https://github.com/abrie/us-census-geocoder
- Owner: abrie
- License: mit
- Created: 2020-09-10T04:57:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-25T15:59:34.000Z (over 4 years ago)
- Last Synced: 2025-01-24T23:27:13.441Z (5 months ago)
- Language: Go
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CLI and Go Wrapper for Census.gov Geocoder
This repository contains a Go module for interfacing with [Census.gov Geocoder](https://geocoding.geo.census.gov/geocoder) REST API. It also includes a CLI utility for interacting with the geocoder. You may run the CLI via the pre-built Docker image or build it yourself using the Go toolchain.
## Use CLI from Docker Image
- `docker run abriedev/us-census-geocoder:latest`
## Build CLI Locally
- Build the CLI using Make: `make build`
- Invoke the CLI without parameters for help: `./bin/cli`Results are written to stdout as JSON.
## Use the API programmatically
- `import ("github.com/abrie/us-census-geocoder")`
Two types of results are available: 'locations' or 'geographies'. Both require a 'benchmark' parameter.
Geographies takes two additional parameters: 'vintage' parameters, and an (optionally empty) 'layers' parameter.### Locations
```go
censusgeocoder.SearchOneLineAddressLocations(ctx context, onelineaddress, benchmark string)
censusgeocoder.SearchAddressLocations(ctx context, street, city, state, benchmark string)
censusgeocoder.SearchByCoordinateLocations(ctx context, x,y float64, benchmark string)
```
### GeographiesGeographies require a 'benchmark', 'vintage' and 'layers' parameter. Leave layers as an empty array for default behaviour.
```go
censusgeocoder.SearchOneLineAddressGeographies(ctx context, onelineaddress, benchmark, vintage string, layers []string)
censusgeocoder.SearchAddressGeographies(ctx context, street, city, state, benchmark, vintage string, layers []string)
censusgeocoder.SearchByCoordinateGeographies(ctx context, x,y float64, benchmark, vintage string, layers[]string)
```### Benchmarks and Vintages
A list of available Benchmarks and/or vintages are available to the API:
```go
censusgeocoder.GetBenchmarks()
censusgeocoder.GetVintages(benchmark string)
```## Technical Details
For more information about the returned fields, see the [official Census.gov documentation](https://geocoding.geo.census.gov/geocoder/Geocoding_Services_API.pdf).