Skip to content

Latest commit

History

History
57 lines (41 loc) 路 1.85 KB

README.md

File metadata and controls

57 lines (41 loc) 路 1.85 KB

abode 馃彔

GoDoc Build Status Go Report Card license

Explode one-line address strings using Golang.

This package uses the Google Maps API to geocode the address. Don't forget to set your GOOGLE_MAPS_API_KEY environment variable.

Installation

go get -u github.com/mattevans/abode

Example

Explode your one-line address...

yourAddress := "193 Rogers Ave, Brooklyn, New York"

// Explode our one-line address into components.
address, err := abode.Explode(yourAddress)
if err != nil {
  return err
}

Which will give you...

abode.Address{
  AddressLine1:     "193 Rogers Avenue",
  AddressLine2:     "Brooklyn"
  AddressCity:      nil,
  AddressState:     "New York"
  AddressCountry:   "United States"
  AddressZip:       "11216"
  AddressLat:       40.6706073,
  AddressLng:       -73.9530182,
  FormattedAddress: "193 Rogers Ave, Brooklyn, NY 11216, USA",
}

Configuration

Each abode.Address{} component can be tailored to meet your needs. Simply adjust the mapping of the Google Maps Address Components here.

Disclaimer

Ensure your end results are used in conjunction with a Google Map to avoid violating the Google Maps API Terms of Service.