Skip to content

pablotron/census-geocoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

census-geocoder

Go wrapper for [Census Geocoding Services API][].

Installation

go get https://pablotron.org/census-geocoder

Example

Minimal tool which geocodes command-line arguments and prints the normalized address from the results to standard output:

package main

import (
  "fmt"
  "log"
  "os"
  "pablotron.org/census-geocoder/geocoder"
)

func main() {
  for _, arg := range(os.Args[1:]) {
    // get address matches
    matches, err := geocoder.Locations(arg)
    if err != nil {
      log.Fatal(err)
    }

    // print matches
    for _, match := range(matches) {
      fmt.Println(match)
    }
  }
}

This example is also available in the Git repository as main.go.

Documentation

See https://pkg.go.dev/pablotron.org/census-geocoder/geocoder