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 48ce60d commit 6b92a91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/geocoding/cmdline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
latlng = flag.String("latlng", "", "The textual latitude/longitude value for which you wish to obtain the closest, human-readable address.")
resultType = flag.String("result_type", "", "One or more address types, separated by a pipe (|).")
locationType = flag.String("location_type", "", "One or more location types, separated by a pipe (|).")
enableAddressDescriptor = flag.String("enable_address_descriptor", "", "True or False. Whether to return the Address Descriptors in the response.")
)

func usageAndExit(msg string) {
Expand Down Expand Up @@ -81,6 +82,7 @@ func main() {
parseLatLng(*latlng, r)
parseResultType(*resultType, r)
parseLocationType(*locationType, r)
parseEnableAddressDescriptor(*enableAddressDescriptor, r)

resp, err := client.Geocode(context.Background(), r)
check(err)
Expand Down Expand Up @@ -187,3 +189,11 @@ func parseLocationType(locationType string, r *maps.GeocodingRequest) {

}
}

func parseEnableAddressDescriptor(enableAddressDescriptor string, r *maps.GeocodingRequest) {
if enableAddressDescriptor == "True" {
r.EnableAddressDescriptor = true
} else {
r.EnableAddressDescriptor = false
}
}

0 comments on commit 6b92a91

Please sign in to comment.