As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Maps Geocode v4 API

class google.maps.geocode_v4.types.Destination(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A destination. This includes the primary place, related places, entrances, and navigation points.

primary

The primary place identified by the primary_query in the request.

Type

google.maps.geocode_v4.types.PlaceView

containing_places

The less precise places that the primary place is contained by. For example, the apartment complex that contains this building.

Type

MutableSequence[google.maps.geocode_v4.types.PlaceView]

sub_destinations

More precise sub-destinations of the primary place. For example, units contained in a building.

Note: compared to the SubDestination returned by the Places API, this list of sub-destinations is more exhaustive, and each sub-destination contains more information.

Type

MutableSequence[google.maps.geocode_v4.types.PlaceView]

landmarks

Landmarks that can be used to communicate where the destination is or help with arrival.

Type

MutableSequence[google.maps.geocode_v4.types.Landmark]

entrances

Entrances for this destination.

Type

MutableSequence[google.maps.geocode_v4.types.Entrance]

navigation_points

Navigation points for this destination.

Type

MutableSequence[google.maps.geocode_v4.types.NavigationPoint]

class google.maps.geocode_v4.types.Entrance(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

An entrance is a single latitude/longitude coordinate pair that defines the location of an entry and exit point for a place.

location

The location of the entrance.

Type

google.type.latlng_pb2.LatLng

tags

A list of tags that describe the entrance.

Type

MutableSequence[google.maps.geocode_v4.types.Entrance.Tag]

place

The structure this entrance is physically located on, in places/{place_id} format.

Type

str

class Tag(value)[source]

Bases: proto.enums.Enum

Characteristics that describe an entrance.

Values:
TAG_UNSPECIFIED (0):

Not used.

PREFERRED (1):

The entrance likely provides physical access to the primary place in the returned destination. A place can have multiple preferred entrances. If an entrance does not have this tag, it means the entrance is physically on the same building as the primary place, but does not necessarily provide access to the place.

For example, if the primary place is a restaurant in a strip mall, the “PREFERRED” entrances will be the ones that likely lead into the restaurant itself, while the other returned entrances will be other entrances for the building, such as entrances into other restaurants in the strip mall.

If the primary place is a building itself, the PREFERRED entrances will be the ones that lead into the “main” part of the building. For example, in a shopping center the PREFERRED entrances will be the ones that allow access to the main foyer area, but if an entrance only provides access to a store on the side of the building, it won’t be a PREFERRED entrance.

Note: a PREFERRED entrance might not provide access to the primary place, and a non-PREFERRED entrance might provide access to the primary place.

class google.maps.geocode_v4.types.GeocodeAddressRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for GeocodeService.GeocodeAddress.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

address_query

The unstructured address to geocode.

This field is a member of oneof address_input.

Type

str

address

The structured address to geocode in postal address format.

This field is a member of oneof address_input.

Type

google.type.postal_address_pb2.PostalAddress

location_bias

Optional. The region to search. This location serves as a bias which means results around the given location are preferred.

Type

google.maps.geocode_v4.types.GeocodeAddressRequest.LocationBias

language_code

Optional. Language in which the results should be returned.

Type

str

region_code

Optional. Region code. The region code, specified as a ccTLD (“top-level domain”) two-character value. The parameter affects results based on applicable law. This parameter will also influence, but not fully restrict, results from the service.

Type

str

class LocationBias(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The region to search. This location serves as a bias which means results around the given location are preferred.

rectangle

A rectangular box defined by northeast and southwest corner. rectangle.high() must be the northeast point of the rectangle viewport. rectangle.low() must be the southwest point of the rectangle viewport. rectangle.low().latitude() cannot be greater than rectangle.high().latitude(). This will result in an empty latitude range. A rectangle viewport cannot be wider than 180 degrees.

This field is a member of oneof type.

Type

google.geo.type.types.Viewport

class google.maps.geocode_v4.types.GeocodeAddressResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for [GeocodeService.GeocodeAddress][google.maps.geocode.v4.GeocodeService.GeocodeAddress].

results

The geocoding result.

Type

MutableSequence[google.maps.geocode_v4.types.GeocodeResult]

class google.maps.geocode_v4.types.GeocodeLocationRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for GeocodeService.GeocodeLocation.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

location_query

The location in the format of “lat,lng” string. For example, “64.7611872,-18.4705364”.

This field is a member of oneof location_input.

Type

str

location

The location in the structured format.

This field is a member of oneof location_input.

Type

google.type.latlng_pb2.LatLng

language_code

Optional. Language in which the results should be returned.

Type

str

region_code

Optional. Region code. The region code, specified as a ccTLD (“top-level domain”) two-character value. The parameter affects results based on applicable law.

Type

str

types

Optional. A set of type tags to restrict the results. Results that do not have any of the specified types are removed.

For the complete list of possible values, see Table A and Table B at https://developers.google.com/maps/documentation/places/web-service/place-types.

Type

MutableSequence[str]

granularity

Optional. A filter of one or more location granularity enums.

Type

MutableSequence[google.maps.geocode_v4.types.GeocodeResult.Granularity]

class google.maps.geocode_v4.types.GeocodeLocationResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for [GeocodeService.GeocodeLocation][google.maps.geocode.v4.GeocodeService.GeocodeLocation].

results

The geocoding result.

Type

MutableSequence[google.maps.geocode_v4.types.GeocodeResult]

plus_code

Plus code of the location in the request.

Type

google.maps.geocode_v4.types.PlusCode

class google.maps.geocode_v4.types.GeocodePlaceRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for GeocodeService.GeocodePlace.

place

Required. Place identifier to geocode in the format of places/{place}.

Type

str

language_code

Optional. Language in which the results should be returned.

Type

str

region_code

Optional. Region code. The region code, specified as a ccTLD (“top-level domain”) two-character value. The parameter affects results based on applicable law.

Type

str

class google.maps.geocode_v4.types.GeocodeResult(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A geocode result contains geographic information about a place.

place

This Place’s resource name, in places/{placeId} format. Can be used to look up the Place.

Type

str

place_id

The unique identifier of a place.

Type

str

location

The latlng of this address.

Type

google.type.latlng_pb2.LatLng

granularity

The granularity of the location.

Type

google.maps.geocode_v4.types.GeocodeResult.Granularity

viewport

A viewport suitable for displaying the geocode result.

Type

google.geo.type.types.Viewport

bounds

A bounding box for the address.

Type

google.geo.type.types.Viewport

formatted_address

The one line formatted address.

Type

str

postal_address

The address in postal address format.

Type

google.type.postal_address_pb2.PostalAddress

address_components

Repeated components for each locality level.

Type

MutableSequence[google.maps.geocode_v4.types.GeocodeResult.AddressComponent]

postal_code_localities

Complete list of localities contained in the postal code.

This is only populated when the result is of type “postal_code”.

Type

MutableSequence[google.type.localized_text_pb2.LocalizedText]

types

A set of type tags for this result. For example, “political” and “administrative_area”.

For the complete list of possible values, see Table A and Table B at https://developers.google.com/maps/documentation/places/web-service/place-types.

Type

MutableSequence[str]

plus_code

Plus code of the location in this geocode.

Type

google.maps.geocode_v4.types.PlusCode

class AddressComponent(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The structured components that form the formatted address, if this information is available.

long_text

The full text description or name of the address component. For example, an address component for the country Australia may have a long name of “Australia”.

Type

str

short_text

An abbreviated textual name for the address component, if available. For example, an address component for the country of Australia may have a short name of “AU”.

Type

str

types

An array indicating the type(s) of the address component. See https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types for more details.

Type

MutableSequence[str]

language_code

The language used to format this component, in CLDR notation.

Type

str

class Granularity(value)[source]

Bases: proto.enums.Enum

The granularity of the location.

Values:
GRANULARITY_UNSPECIFIED (0):

Do not use.

ROOFTOP (1):

The non-interpolated location of an actual plot of land corresponding to the matched address.

RANGE_INTERPOLATED (2):

Interpolated from a range of street numbers. For example, if we know that a segment of Amphitheatre Pkwy contains numbers 1600 - 1699, then 1650 might be placed halfway between its endpoints.

GEOMETRIC_CENTER (3):

The geometric center of a feature for which we have polygonal data.

APPROXIMATE (4):

Everything else.

class google.maps.geocode_v4.types.Landmark(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Landmarks are used to communicate where the destination is or help with arriving at the destination.

place

The place that represents this landmark.

This field is a member of oneof landmark.

Type

google.maps.geocode_v4.types.PlaceView

relational_description

A human-readable description of how the destination relates to the landmark. For example: “Near the Empire State Building” or “Across from the White House”.

Type

google.type.localized_text_pb2.LocalizedText

tags

Tags that describe how the landmark can be used in the context of the destination.

Type

MutableSequence[google.maps.geocode_v4.types.Landmark.Tag]

straight_line_distance_meters

Output only. The straight-line distance from this landmark to the destination in meters.

Type

float

travel_distance_meters

Output only. The road-network distance from this landmark to the destination in meters.

Type

float

class Tag(value)[source]

Bases: proto.enums.Enum

The list of all possible tags that describe how a landmark can be used in the context of a destination.

If an address has both the ADDRESS and ARRIVAL tags, it means the landmark is both locally prominent and close to the destination.

Values:
TAG_UNSPECIFIED (0):

Not used.

ADDRESS (1):

A locally prominent place that can be used to identify the general location of the destination. Typically within a few hundred meters of the destination. These are similar to the landmarks returned by the Address Descriptors feature of the Geocoding API:

https://developers.google.com/maps/documentation/geocoding/address-descriptors/requests-address-descriptors.

ARRIVAL (2):

A place that can be used to help arrive at the destination. Useful for navigation once you are close to the destination. For example, this landmark might be a place that is across the street from the destination. A landmark with this tag is typically closer to the destination than landmarks with the ADDRESS tag.

class google.maps.geocode_v4.types.NavigationPoint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A navigation point is a location next to a road where navigation can end.

navigation_point_token

Output only. A token that can be used to identify this navigation point.

Type

str

display_name

The display name of this navigation point. For example, “5th Ave” or “Gate B”.

Type

google.type.localized_text_pb2.LocalizedText

location

A point next to the road segment where navigation should end. The point is intentionally slightly offset from the road’s centerline to clearly mark the side of the road where the place is located.

Type

google.type.latlng_pb2.LatLng

travel_modes

Travel modes that are appropriate for this navigation point.

Type

MutableSequence[google.maps.geocode_v4.types.NavigationPoint.TravelMode]

usages

Lists usages supported by this navigation point. If empty, it does not necessarily mean its usage is restricted in any way. All navigation points can be used for general navigation.

Type

MutableSequence[google.maps.geocode_v4.types.NavigationPoint.Usage]

class TravelMode(value)[source]

Bases: proto.enums.Enum

Travel modes that are appropriate for this navigation point.

Values:
TRAVEL_MODE_UNSPECIFIED (0):

Not used.

DRIVE (1):

Suitable for driving.

WALK (2):

Suitable for walking.

class Usage(value)[source]

Bases: proto.enums.Enum

Usages supported by this navigation point. New values may be added in the future.

Values:
USAGE_UNSPECIFIED (0):

Not used.

UNKNOWN (1):

Indicates that the usage type is unknown.

DROPOFF (2):

Suitable for dropping off a passenger. For example, a rideshare drop off location.

PICKUP (3):

Suitable for picking up a passenger. For example, a rideshare pick up location.

PARKING (4):

Suitable for parking. For example, within a parking lot.

class google.maps.geocode_v4.types.PlaceView(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Represents a view of a Place in the Places API. It also provides additional information specific to destinations, such as the structure type and the display polygon.

In some cases, a PlaceView with the same place ID might differ from what is being returned by the Places API for the types and display_name fields.

place

This Place’s resource name, in places/{placeId} format. Can be used to look up the Place.

Type

str

place_id

The unique identifier of a place.

Type

str

display_name

Human readable place description. For example, “Gate B”, “McDonalds”.

Type

google.type.localized_text_pb2.LocalizedText

primary_type

The primary place type of this place. See https://developers.google.com/maps/documentation/places/web-service/place-types for the list of possible values.

Note: This field is not always populated. Be prepared to use the types field in such situations.

Type

str

types

All associated place types of this place. See https://developers.google.com/maps/documentation/places/web-service/place-types for the list of possible values.

Type

MutableSequence[str]

formatted_address

One line address.

Type

str

postal_address

Structured address.

Type

google.type.postal_address_pb2.PostalAddress

structure_type

The type of structure corresponding to this place.

Type

google.maps.geocode_v4.types.PlaceView.StructureType

location

The location of this place. For places with display polygons, this can represent a good spot to put a marker on the map.

Type

google.type.latlng_pb2.LatLng

display_polygon

The polygon outline of the place in GeoJSON format, using the RFC 7946 format: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6.

Note: The RFC 7946 format supports MultiPolygons, so one display_polygon object can represent multiple polygons.

Type

google.protobuf.struct_pb2.Struct

class StructureType(value)[source]

Bases: proto.enums.Enum

The type of structure that this place represents.

Values:
STRUCTURE_TYPE_UNSPECIFIED (0):

Not used.

POINT (1):

A point location.

SECTION (2):

A sub-section of a building.

BUILDING (3):

A building.

GROUNDS (4):

A large area that typically contains multiple buildings, such as a university campus, an apartment complex, or a shopping mall.

class google.maps.geocode_v4.types.PlusCode(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Plus code (http://plus.codes) is a location reference with two formats: global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, and compound code, replacing the prefix with a reference location.

global_code

Place’s global (full) code, such as “9FWM33GV+HQ”, representing an 1/8000 by 1/8000 degree area (~14 by 14 meters).

Type

str

compound_code

Place’s compound code, such as “33GV+HQ, Ramberg, Norway”, containing the suffix of the global code and replacing the prefix with a formatted name of a reference entity.

Type

str

class google.maps.geocode_v4.types.SearchDestinationsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for DestinationService.SearchDestinations.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

place

The resource name of a place, in places/{place_id} format.

This field is a member of oneof primary_query.

Type

str

address_query

A street address.

This field is a member of oneof primary_query.

Type

google.maps.geocode_v4.types.SearchDestinationsRequest.AddressQuery

location_query

A precise location.

This field is a member of oneof primary_query.

Type

google.maps.geocode_v4.types.SearchDestinationsRequest.LocationQuery

travel_modes

Optional. The travel modes to filter navigation points for. This influences the navigation_points field returned in the response. If empty, navigation points of all travel modes are returned.

Type

MutableSequence[google.maps.geocode_v4.types.NavigationPoint.TravelMode]

language_code

Optional. Language in which the results should be returned.

Type

str

region_code

Optional. Region code. The region code, specified as a ccTLD (“top-level domain”) two-character value. The parameter affects results based on applicable law. This parameter also influences, but not fully restricts, results from the service.

Type

str

class AddressQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The street address that you want to search for. Specify addresses in accordance with the format used by the national postal service of the country concerned.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

address

A street address in postal address format.

This field is a member of oneof kind.

Type

google.type.postal_address_pb2.PostalAddress

address_query

A street address formatted as a single line.

This field is a member of oneof kind.

Type

str

class LocationQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A location query to identify a nearby primary destination.

Note: if the location query is within a building that contains subpremises, it is possible that the returned primary place is a subpremise. In these cases, the containing_places field will include the building.

location

A precise LatLng location.

This field is a member of oneof kind.

Type

google.type.latlng_pb2.LatLng

place_filter

Optional. Filters to apply to destination candidates.

Type

google.maps.geocode_v4.types.SearchDestinationsRequest.LocationQuery.PlaceFilter

class PlaceFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Filters to apply to destination candidates.

structure_type

Optional. If specified, all destinations are guaranteed to have a primary place with this structure type. This can result in filtering out some destinations, or in coarsening/refining the returned destinations.

For example, if GROUNDS is specified, all returned destinations will have a primary place with the GROUNDS structure type. This can result in filtering out some destinations that are not part of a grounds, or in coarsening the returned destinations to the grounds level.

Another use of this field is to more easily extract building display polygons. For example, if BUILDING is specified, the primary place’s display polygon will be for the building at the specified location.

Type

google.maps.geocode_v4.types.PlaceView.StructureType

addressability

Optional. If specified, only returns destinations that meet the corresponding addressability criteria.

Type

google.maps.geocode_v4.types.SearchDestinationsRequest.LocationQuery.PlaceFilter.Addressability

class Addressability(value)[source]

Bases: proto.enums.Enum

Defines options for addressability filtering. New values may be added in the future.

Values:
ADDRESSABILITY_UNSPECIFIED (0):

When unspecified, the service will choose a sensible default.

ANY (1):

Addressability is not a filtering criteria. Destinations are returned regardless of their addressability.

PRIMARY (2):

All destinations returned will have a primary place with a street level address or name.

WEAK (3):

All destinations returned will have either a primary place or a subdestination with a street level address or name.

class google.maps.geocode_v4.types.SearchDestinationsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for DestinationService.SearchDestinations.

destinations

A list of destinations.

The service returns one result if a primary destination can be unambiguously identified from the primary query. Otherwise, the service might return multiple results for disambiguation or zero results.

Type

MutableSequence[google.maps.geocode_v4.types.Destination]