Skip to content

Commit

Permalink
feat! Added Address Descriptors to Geocoding response. Refactored Geo…
Browse files Browse the repository at this point in the history
…coding response to allow fields outside the geocoding result to be exposed through the client.
  • Loading branch information
Tom Clifford committed Apr 8, 2024
1 parent 9a377e9 commit 48ce60d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,37 @@ func main() {
}
```

Sample usage of the Geocoding API with an API key to get an [Address Descriptor](https://mapsplatform.google.com/demos/address-descriptors/):

```go
package main

import (
"context"
"log"

"github.com/kr/pretty"
"googlemaps.github.io/maps"
)

func main() {
c, err := maps.NewClient(maps.WithAPIKey("Insert-API-Key-Here"))
if err != nil {
log.Fatalf("fatal error: %s", err)
}
r := &maps.GeocodingRequest{
LatLng: &LatLng{Lat: 40.714224, Lng: -73.961452},
EnableAddressDescriptor: True
}
reverseGeocodingResponse, _, err := c.ReverseGeocode(context.Background(), r)
if err != nil {
log.Fatalf("fatal error: %s", err)
}

pretty.Println(reverseGeocodingResponse)
}
```

## Features

### Rate limiting
Expand Down

0 comments on commit 48ce60d

Please sign in to comment.