Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

mattevans/abode

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abode 🏠

GoDoc Build Status Go Report Card license

  • Geocode one-line addresses.
  • Determine timezone information for a given address.
  • This package uses the Google Maps Web Services to geocode the address.
  • You will require the Geocoding API enabled, and optionally the [Timezone API] if you wish to also use Timezone().
  • Remember to set your GOOGLE_MAPS_API_KEY environment variable.

Installation

go get -u github.com/mattevans/abode

Example

Geocode an address:

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

address, err := abode.ExplodeWithContext(ctx, addr)
if err != nil {
  return err
}

Returns...

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",
}

Timezone information for an address:

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

address, err := abode.Timezone(ctx, addr)
if err != nil {
  return err
}

Returns...

abode.Location{
    DstOffset:     0,
    RawOffset:     -17762,
    TimeZoneId:    "GMT-04:56:02",
    TimeZoneName:  "America/New_York"
}

Disclaimer

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

About

🏠 Explode one-line address strings using Golang

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.