https://github.com/mattevans/abode
🏠 Explode one-line address strings using Golang
https://github.com/mattevans/abode
address address-parser geocode geocode-addresses golang golang-library google-maps-api
Last synced: about 1 month ago
JSON representation
🏠 Explode one-line address strings using Golang
- Host: GitHub
- URL: https://github.com/mattevans/abode
- Owner: mattevans
- License: mit
- Created: 2017-04-10T00:55:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-31T23:52:31.000Z (over 3 years ago)
- Last Synced: 2024-06-19T00:22:36.172Z (over 1 year ago)
- Topics: address, address-parser, geocode, geocode-addresses, golang, golang-library, google-maps-api
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 53
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# abode 🏠
[](https://godoc.org/github.com/mattevans/abode)
[](https://travis-ci.org/mattevans/abode)
[](https://goreportcard.com/report/github.com/mattevans/abode)
[](https://github.com/mattevans/abode/blob/master/LICENSE)
- Geocode one-line addresses.
- Determine timezone information for a given address.
- This package uses the [Google Maps Web Services](https://developers.google.com/maps/web-services) to geocode the address.
- You will require the [Geocoding API](https://developers.google.com/maps/documentation) 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:
```go
addr := "193 Rogers Ave, Brooklyn, New York"
address, err := abode.ExplodeWithContext(ctx, addr)
if err != nil {
return err
}
```
Returns...
```go
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:
```go
addr := "193 Rogers Ave, Brooklyn, New York"
address, err := abode.Timezone(ctx, addr)
if err != nil {
return err
}
```
Returns...
```go
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](https://developers.google.com/maps/documentation/geocoding/policies).