|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Copyright 2025 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +from __future__ import annotations |
| 17 | + |
| 18 | +from typing import MutableMapping, MutableSequence |
| 19 | + |
| 20 | +from google.type import localized_text_pb2 # type: ignore |
| 21 | +import proto # type: ignore |
| 22 | + |
| 23 | +__protobuf__ = proto.module( |
| 24 | + package="google.maps.places.v1", |
| 25 | + manifest={ |
| 26 | + "AddressDescriptor", |
| 27 | + }, |
| 28 | +) |
| 29 | + |
| 30 | + |
| 31 | +class AddressDescriptor(proto.Message): |
| 32 | + r"""A relational description of a location. Includes a ranked set |
| 33 | + of nearby landmarks and precise containing areas and their |
| 34 | + relationship to the target location. |
| 35 | +
|
| 36 | + Attributes: |
| 37 | + landmarks (MutableSequence[google.maps.places_v1.types.AddressDescriptor.Landmark]): |
| 38 | + A ranked list of nearby landmarks. The most |
| 39 | + recognizable and nearby landmarks are ranked |
| 40 | + first. |
| 41 | + areas (MutableSequence[google.maps.places_v1.types.AddressDescriptor.Area]): |
| 42 | + A ranked list of containing or adjacent |
| 43 | + areas. The most recognizable and precise areas |
| 44 | + are ranked first. |
| 45 | + """ |
| 46 | + |
| 47 | + class Landmark(proto.Message): |
| 48 | + r"""Basic landmark information and the landmark's relationship |
| 49 | + with the target location. |
| 50 | +
|
| 51 | + Landmarks are prominent places that can be used to describe a |
| 52 | + location. |
| 53 | +
|
| 54 | +
|
| 55 | + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields |
| 56 | +
|
| 57 | + Attributes: |
| 58 | + name (str): |
| 59 | + The landmark's resource name. |
| 60 | + place_id (str): |
| 61 | + The landmark's place id. |
| 62 | + display_name (google.type.localized_text_pb2.LocalizedText): |
| 63 | + The landmark's display name. |
| 64 | + types (MutableSequence[str]): |
| 65 | + A set of type tags for this landmark. For a |
| 66 | + complete list of possible values, see |
| 67 | + https://developers.google.com/maps/documentation/places/web-service/place-types. |
| 68 | + spatial_relationship (google.maps.places_v1.types.AddressDescriptor.Landmark.SpatialRelationship): |
| 69 | + Defines the spatial relationship between the |
| 70 | + target location and the landmark. |
| 71 | + straight_line_distance_meters (float): |
| 72 | + The straight line distance, in meters, between the center |
| 73 | + point of the target and the center point of the landmark. In |
| 74 | + some situations, this value can be longer than |
| 75 | + ``travel_distance_meters``. |
| 76 | + travel_distance_meters (float): |
| 77 | + The travel distance, in meters, along the |
| 78 | + road network from the target to the landmark, if |
| 79 | + known. This value does not take into account the |
| 80 | + mode of transportation, such as walking, |
| 81 | + driving, or biking. |
| 82 | +
|
| 83 | + This field is a member of `oneof`_ ``_travel_distance_meters``. |
| 84 | + """ |
| 85 | + |
| 86 | + class SpatialRelationship(proto.Enum): |
| 87 | + r"""Defines the spatial relationship between the target location |
| 88 | + and the landmark. |
| 89 | +
|
| 90 | + Values: |
| 91 | + NEAR (0): |
| 92 | + This is the default relationship when nothing |
| 93 | + more specific below applies. |
| 94 | + WITHIN (1): |
| 95 | + The landmark has a spatial geometry and the |
| 96 | + target is within its bounds. |
| 97 | + BESIDE (2): |
| 98 | + The target is directly adjacent to the |
| 99 | + landmark. |
| 100 | + ACROSS_THE_ROAD (3): |
| 101 | + The target is directly opposite the landmark |
| 102 | + on the other side of the road. |
| 103 | + DOWN_THE_ROAD (4): |
| 104 | + On the same route as the landmark but not |
| 105 | + besides or across. |
| 106 | + AROUND_THE_CORNER (5): |
| 107 | + Not on the same route as the landmark but a |
| 108 | + single turn away. |
| 109 | + BEHIND (6): |
| 110 | + Close to the landmark's structure but further |
| 111 | + away from its street entrances. |
| 112 | + """ |
| 113 | + NEAR = 0 |
| 114 | + WITHIN = 1 |
| 115 | + BESIDE = 2 |
| 116 | + ACROSS_THE_ROAD = 3 |
| 117 | + DOWN_THE_ROAD = 4 |
| 118 | + AROUND_THE_CORNER = 5 |
| 119 | + BEHIND = 6 |
| 120 | + |
| 121 | + name: str = proto.Field( |
| 122 | + proto.STRING, |
| 123 | + number=1, |
| 124 | + ) |
| 125 | + place_id: str = proto.Field( |
| 126 | + proto.STRING, |
| 127 | + number=2, |
| 128 | + ) |
| 129 | + display_name: localized_text_pb2.LocalizedText = proto.Field( |
| 130 | + proto.MESSAGE, |
| 131 | + number=3, |
| 132 | + message=localized_text_pb2.LocalizedText, |
| 133 | + ) |
| 134 | + types: MutableSequence[str] = proto.RepeatedField( |
| 135 | + proto.STRING, |
| 136 | + number=4, |
| 137 | + ) |
| 138 | + spatial_relationship: "AddressDescriptor.Landmark.SpatialRelationship" = ( |
| 139 | + proto.Field( |
| 140 | + proto.ENUM, |
| 141 | + number=5, |
| 142 | + enum="AddressDescriptor.Landmark.SpatialRelationship", |
| 143 | + ) |
| 144 | + ) |
| 145 | + straight_line_distance_meters: float = proto.Field( |
| 146 | + proto.FLOAT, |
| 147 | + number=6, |
| 148 | + ) |
| 149 | + travel_distance_meters: float = proto.Field( |
| 150 | + proto.FLOAT, |
| 151 | + number=7, |
| 152 | + optional=True, |
| 153 | + ) |
| 154 | + |
| 155 | + class Area(proto.Message): |
| 156 | + r"""Area information and the area's relationship with the target |
| 157 | + location. |
| 158 | + Areas includes precise sublocality, neighborhoods, and large |
| 159 | + compounds that are useful for describing a location. |
| 160 | +
|
| 161 | + Attributes: |
| 162 | + name (str): |
| 163 | + The area's resource name. |
| 164 | + place_id (str): |
| 165 | + The area's place id. |
| 166 | + display_name (google.type.localized_text_pb2.LocalizedText): |
| 167 | + The area's display name. |
| 168 | + containment (google.maps.places_v1.types.AddressDescriptor.Area.Containment): |
| 169 | + Defines the spatial relationship between the |
| 170 | + target location and the area. |
| 171 | + """ |
| 172 | + |
| 173 | + class Containment(proto.Enum): |
| 174 | + r"""Defines the spatial relationship between the target location |
| 175 | + and the area. |
| 176 | +
|
| 177 | + Values: |
| 178 | + CONTAINMENT_UNSPECIFIED (0): |
| 179 | + The containment is unspecified. |
| 180 | + WITHIN (1): |
| 181 | + The target location is within the area |
| 182 | + region, close to the center. |
| 183 | + OUTSKIRTS (2): |
| 184 | + The target location is within the area |
| 185 | + region, close to the edge. |
| 186 | + NEAR (3): |
| 187 | + The target location is outside the area |
| 188 | + region, but close by. |
| 189 | + """ |
| 190 | + CONTAINMENT_UNSPECIFIED = 0 |
| 191 | + WITHIN = 1 |
| 192 | + OUTSKIRTS = 2 |
| 193 | + NEAR = 3 |
| 194 | + |
| 195 | + name: str = proto.Field( |
| 196 | + proto.STRING, |
| 197 | + number=1, |
| 198 | + ) |
| 199 | + place_id: str = proto.Field( |
| 200 | + proto.STRING, |
| 201 | + number=2, |
| 202 | + ) |
| 203 | + display_name: localized_text_pb2.LocalizedText = proto.Field( |
| 204 | + proto.MESSAGE, |
| 205 | + number=3, |
| 206 | + message=localized_text_pb2.LocalizedText, |
| 207 | + ) |
| 208 | + containment: "AddressDescriptor.Area.Containment" = proto.Field( |
| 209 | + proto.ENUM, |
| 210 | + number=4, |
| 211 | + enum="AddressDescriptor.Area.Containment", |
| 212 | + ) |
| 213 | + |
| 214 | + landmarks: MutableSequence[Landmark] = proto.RepeatedField( |
| 215 | + proto.MESSAGE, |
| 216 | + number=1, |
| 217 | + message=Landmark, |
| 218 | + ) |
| 219 | + areas: MutableSequence[Area] = proto.RepeatedField( |
| 220 | + proto.MESSAGE, |
| 221 | + number=2, |
| 222 | + message=Area, |
| 223 | + ) |
| 224 | + |
| 225 | + |
| 226 | +__all__ = tuple(sorted(__protobuf__.manifest)) |
0 commit comments