hyperion.adapters.geocoder.google¶
hyperion.adapters.geocoder.google
¶
Google Maps :class:~hyperion.ports.geocoder.Geocoder adapter.
Requires the googlemaps client ([geo] extra). The geocode cache is an
injected :class:~hyperion.ports.keyval.KeyValueStore -- this adapter never
touches :class:Catalog (the PersistentCache knot removed in Step 7,
docs/ddd-refactor-plan.md F3 / F4).
GoogleMaps
¶
Google Maps API client implementing :class:~hyperion.ports.geocoder.Geocoder.
Initialize the Google Maps API client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
The Google Maps API key. |
required |
keyval
|
KeyValueStore
|
Backing store for the geocode
cache. Defaults to a non-persistent :class: |
None
|
Source code in hyperion/adapters/geocoder/google.py
from_config
classmethod
¶
Build a Google Maps client from the configuration.
Returns a fresh instance (no singleton); the geocode cache defaults to
a non-persistent :class:InMemoryStore. Wire a persistent
:class:~hyperion.ports.keyval.KeyValueStore explicitly if you need
cross-process caching.
Source code in hyperion/adapters/geocoder/google.py
geocode
¶
Geocode an address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
The address to geocode. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Location |
Location
|
The geocoded location. |
Source code in hyperion/adapters/geocoder/google.py
reverse_geocode
¶
Reverse geocode a location into an address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
Location
|
The location coordinates. |
required |
language
|
str
|
The language in which to return results. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
NamedLocation
|
The address name. |
Source code in hyperion/adapters/geocoder/google.py
get_altitude
¶
Get altitude of the given location using Elevation API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
Location
|
The location coordinates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The altitude in meters above sea level |