stadiamaps 1.0.7__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stadiamaps/__init__.py +6 -24
- stadiamaps/api/geocoding_api.py +1917 -760
- stadiamaps/api/geospatial_api.py +483 -221
- stadiamaps/api/routing_api.py +1615 -723
- stadiamaps/api_client.py +275 -272
- stadiamaps/api_response.py +12 -16
- stadiamaps/configuration.py +13 -11
- stadiamaps/exceptions.py +67 -30
- stadiamaps/models/__init__.py +5 -23
- stadiamaps/models/access.py +44 -26
- stadiamaps/models/admin_region.py +46 -28
- stadiamaps/models/administrative.py +48 -30
- stadiamaps/models/auto_costing_options.py +75 -48
- stadiamaps/models/base_costing_options.py +59 -34
- stadiamaps/models/base_trace_request.py +70 -40
- stadiamaps/models/bicycle_costing_options.py +67 -42
- stadiamaps/models/bike_network.py +42 -24
- stadiamaps/models/contour.py +45 -27
- stadiamaps/models/coordinate.py +45 -26
- stadiamaps/models/costing_model.py +10 -12
- stadiamaps/models/costing_options.py +51 -33
- stadiamaps/models/directions_options.py +45 -27
- stadiamaps/models/distance_unit.py +8 -11
- stadiamaps/models/edge_sign.py +46 -28
- stadiamaps/models/edge_use.py +8 -11
- stadiamaps/models/end_node.py +48 -30
- stadiamaps/models/geo_attributes.py +47 -29
- stadiamaps/models/geo_json_geometry.py +25 -25
- stadiamaps/models/geo_json_geometry_base.py +45 -27
- stadiamaps/models/geo_json_line_string.py +47 -28
- stadiamaps/models/geo_json_line_string_all_of.py +1 -1
- stadiamaps/models/geo_json_point.py +47 -28
- stadiamaps/models/geo_json_point_all_of.py +1 -1
- stadiamaps/models/geo_json_polygon.py +47 -28
- stadiamaps/models/geo_json_polygon_all_of.py +1 -1
- stadiamaps/models/geocoding_object.py +46 -28
- stadiamaps/models/height_request.py +55 -34
- stadiamaps/models/height_response.py +49 -30
- stadiamaps/models/highway_classification.py +52 -34
- stadiamaps/models/intersecting_edge.py +45 -27
- stadiamaps/models/isochrone_costing_model.py +8 -11
- stadiamaps/models/isochrone_feature.py +45 -27
- stadiamaps/models/isochrone_properties.py +48 -30
- stadiamaps/models/isochrone_request.py +54 -35
- stadiamaps/models/isochrone_response.py +47 -29
- stadiamaps/models/locate_detailed_edge.py +73 -55
- stadiamaps/models/locate_edge.py +56 -39
- stadiamaps/models/locate_edge_info.py +47 -29
- stadiamaps/models/locate_node.py +50 -31
- stadiamaps/models/locate_object.py +49 -31
- stadiamaps/models/maneuver_sign.py +50 -32
- stadiamaps/models/maneuver_sign_element.py +45 -27
- stadiamaps/models/map_match_costing_model.py +8 -11
- stadiamaps/models/map_match_request.py +74 -44
- stadiamaps/models/map_match_route_response.py +57 -29
- stadiamaps/models/map_match_trace_options.py +47 -29
- stadiamaps/models/map_match_waypoint.py +49 -30
- stadiamaps/models/matched_point.py +52 -34
- stadiamaps/models/matrix_costing_model.py +9 -12
- stadiamaps/models/matrix_distance.py +46 -28
- stadiamaps/models/matrix_request.py +70 -39
- stadiamaps/models/matrix_response.py +60 -36
- stadiamaps/models/motor_scooter_costing_options.py +76 -49
- stadiamaps/models/motorcycle_costing_options.py +75 -48
- stadiamaps/models/nearest_roads_request.py +65 -34
- stadiamaps/models/node_id.py +42 -24
- stadiamaps/models/node_type.py +8 -11
- stadiamaps/models/optimized_route_request.py +66 -35
- stadiamaps/models/pedestrian_costing_options.py +59 -40
- stadiamaps/models/pelias_geo_json_feature.py +50 -31
- stadiamaps/models/pelias_geo_json_properties.py +54 -36
- stadiamaps/models/pelias_geo_json_properties_addendum.py +43 -25
- stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +42 -24
- stadiamaps/models/pelias_layer.py +8 -11
- stadiamaps/models/pelias_response.py +49 -30
- stadiamaps/models/pelias_source.py +8 -11
- stadiamaps/models/restrictions.py +44 -26
- stadiamaps/models/road_class.py +8 -11
- stadiamaps/models/route_leg.py +48 -29
- stadiamaps/models/route_maneuver.py +73 -55
- stadiamaps/models/route_request.py +76 -43
- stadiamaps/models/route_response.py +56 -28
- stadiamaps/models/route_response_alternates_inner.py +105 -0
- stadiamaps/models/route_summary.py +48 -30
- stadiamaps/models/route_trip.py +135 -0
- stadiamaps/models/routing_response_waypoint.py +49 -30
- stadiamaps/models/routing_waypoint.py +60 -41
- stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
- stadiamaps/models/simple_routing_waypoint.py +48 -29
- stadiamaps/models/speeds.py +49 -31
- stadiamaps/models/trace_attribute_filter_options.py +47 -28
- stadiamaps/models/trace_attribute_key.py +8 -11
- stadiamaps/models/trace_attributes_base_response.py +51 -32
- stadiamaps/models/trace_attributes_request.py +72 -42
- stadiamaps/models/trace_attributes_request_all_of_filters.py +1 -1
- stadiamaps/models/trace_attributes_response.py +54 -35
- stadiamaps/models/trace_edge.py +88 -70
- stadiamaps/models/travel_mode.py +8 -11
- stadiamaps/models/traversability.py +8 -11
- stadiamaps/models/truck_costing_options.py +78 -51
- stadiamaps/models/tz_response.py +45 -27
- stadiamaps/models/valhalla_languages.py +8 -11
- stadiamaps/models/valhalla_long_units.py +8 -11
- stadiamaps/models/warning.py +42 -24
- stadiamaps/py.typed +0 -0
- stadiamaps/rest.py +127 -172
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/METADATA +4 -4
- stadiamaps-2.1.0.dist-info/RECORD +128 -0
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/WHEEL +1 -1
- stadiamaps-1.0.7.dist-info/RECORD +0 -125
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/LICENSE.txt +0 -0
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/top_level.txt +0 -0
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,69 +18,99 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import List, Optional
|
23
|
-
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist, validator
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
24
23
|
from stadiamaps.models.costing_options import CostingOptions
|
25
|
-
from stadiamaps.models.
|
24
|
+
from stadiamaps.models.distance_unit import DistanceUnit
|
26
25
|
from stadiamaps.models.map_match_costing_model import MapMatchCostingModel
|
27
26
|
from stadiamaps.models.map_match_trace_options import MapMatchTraceOptions
|
28
27
|
from stadiamaps.models.map_match_waypoint import MapMatchWaypoint
|
28
|
+
from stadiamaps.models.valhalla_languages import ValhallaLanguages
|
29
|
+
from typing import Optional, Set
|
30
|
+
from typing_extensions import Self
|
29
31
|
|
30
32
|
class MapMatchRequest(BaseModel):
|
31
33
|
"""
|
32
34
|
MapMatchRequest
|
33
|
-
"""
|
34
|
-
id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
|
35
|
-
shape: Optional[
|
36
|
-
encoded_polyline: Optional[StrictStr] = Field(None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
|
37
|
-
costing: MapMatchCostingModel
|
35
|
+
""" # noqa: E501
|
36
|
+
id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
|
37
|
+
shape: Optional[List[MapMatchWaypoint]] = Field(default=None, description="REQUIRED if `encoded_polyline` is not present. Note that `break` type locations are only supported when `shape_match` is set to `map_match`.")
|
38
|
+
encoded_polyline: Optional[StrictStr] = Field(default=None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
|
39
|
+
costing: MapMatchCostingModel
|
38
40
|
costing_options: Optional[CostingOptions] = None
|
39
|
-
shape_match: Optional[StrictStr] = Field(None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
shape_match: Optional[StrictStr] = Field(default=None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
|
42
|
+
units: Optional[DistanceUnit] = None
|
43
|
+
language: Optional[ValhallaLanguages] = None
|
44
|
+
directions_type: Optional[StrictStr] = Field(default='instructions', description="The level of directional narrative to include. Locations and times will always be returned, but narrative generation verbosity can be controlled with this parameter.")
|
45
|
+
begin_time: Optional[StrictInt] = Field(default=None, description="The timestamp at the start of the trace. Combined with `durations`, this provides a way to include timing information for an `encoded_polyline` trace.")
|
46
|
+
durations: Optional[StrictInt] = Field(default=None, description="A list of durations (in seconds) between each successive pair of points in a polyline.")
|
47
|
+
use_timestamps: Optional[StrictBool] = Field(default=False, description="If true, the input timestamps or durations should be used when computing elapsed time for each edge along the matched path rather than the routing algorithm estimates.")
|
44
48
|
trace_options: Optional[MapMatchTraceOptions] = None
|
45
|
-
linear_references: Optional[StrictBool] = Field(False, description="If true, the response will include a `linear_references` value that contains an array of base64-encoded [OpenLR location references](https://www.openlr-association.com/fileadmin/user_upload/openlr-whitepaper_v1.5.pdf), one for each graph edge of the road network matched by the trace.")
|
49
|
+
linear_references: Optional[StrictBool] = Field(default=False, description="If true, the response will include a `linear_references` value that contains an array of base64-encoded [OpenLR location references](https://www.openlr-association.com/fileadmin/user_upload/openlr-whitepaper_v1.5.pdf), one for each graph edge of the road network matched by the trace.")
|
46
50
|
additional_properties: Dict[str, Any] = {}
|
47
|
-
__properties = ["id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match", "
|
51
|
+
__properties: ClassVar[List[str]] = ["id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match", "units", "language", "directions_type", "begin_time", "durations", "use_timestamps", "trace_options", "linear_references"]
|
48
52
|
|
49
|
-
@
|
53
|
+
@field_validator('shape_match')
|
50
54
|
def shape_match_validate_enum(cls, value):
|
51
55
|
"""Validates the enum"""
|
52
56
|
if value is None:
|
53
57
|
return value
|
54
58
|
|
55
|
-
if value not in ('edge_walk', 'map_snap', 'walk_or_snap'):
|
59
|
+
if value not in set(['edge_walk', 'map_snap', 'walk_or_snap']):
|
56
60
|
raise ValueError("must be one of enum values ('edge_walk', 'map_snap', 'walk_or_snap')")
|
57
61
|
return value
|
58
62
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
@field_validator('directions_type')
|
64
|
+
def directions_type_validate_enum(cls, value):
|
65
|
+
"""Validates the enum"""
|
66
|
+
if value is None:
|
67
|
+
return value
|
68
|
+
|
69
|
+
if value not in set(['none', 'maneuvers', 'instructions']):
|
70
|
+
raise ValueError("must be one of enum values ('none', 'maneuvers', 'instructions')")
|
71
|
+
return value
|
72
|
+
|
73
|
+
model_config = ConfigDict(
|
74
|
+
populate_by_name=True,
|
75
|
+
validate_assignment=True,
|
76
|
+
protected_namespaces=(),
|
77
|
+
)
|
78
|
+
|
63
79
|
|
64
80
|
def to_str(self) -> str:
|
65
81
|
"""Returns the string representation of the model using alias"""
|
66
|
-
return pprint.pformat(self.
|
82
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
67
83
|
|
68
84
|
def to_json(self) -> str:
|
69
85
|
"""Returns the JSON representation of the model using alias"""
|
86
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
70
87
|
return json.dumps(self.to_dict())
|
71
88
|
|
72
89
|
@classmethod
|
73
|
-
def from_json(cls, json_str: str) ->
|
90
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
74
91
|
"""Create an instance of MapMatchRequest from a JSON string"""
|
75
92
|
return cls.from_dict(json.loads(json_str))
|
76
93
|
|
77
|
-
def to_dict(self):
|
78
|
-
"""
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
94
|
+
def to_dict(self) -> Dict[str, Any]:
|
95
|
+
"""Return the dictionary representation of the model using alias.
|
96
|
+
|
97
|
+
This has the following differences from calling pydantic's
|
98
|
+
`self.model_dump(by_alias=True)`:
|
99
|
+
|
100
|
+
* `None` is only added to the output dict for nullable fields that
|
101
|
+
were set at model initialization. Other fields with value `None`
|
102
|
+
are ignored.
|
103
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
104
|
+
"""
|
105
|
+
excluded_fields: Set[str] = set([
|
106
|
+
"additional_properties",
|
107
|
+
])
|
108
|
+
|
109
|
+
_dict = self.model_dump(
|
110
|
+
by_alias=True,
|
111
|
+
exclude=excluded_fields,
|
112
|
+
exclude_none=True,
|
113
|
+
)
|
84
114
|
# override the default output from pydantic by calling `to_dict()` of each item in shape (list)
|
85
115
|
_items = []
|
86
116
|
if self.shape:
|
@@ -91,9 +121,6 @@ class MapMatchRequest(BaseModel):
|
|
91
121
|
# override the default output from pydantic by calling `to_dict()` of costing_options
|
92
122
|
if self.costing_options:
|
93
123
|
_dict['costing_options'] = self.costing_options.to_dict()
|
94
|
-
# override the default output from pydantic by calling `to_dict()` of directions_options
|
95
|
-
if self.directions_options:
|
96
|
-
_dict['directions_options'] = self.directions_options.to_dict()
|
97
124
|
# override the default output from pydantic by calling `to_dict()` of trace_options
|
98
125
|
if self.trace_options:
|
99
126
|
_dict['trace_options'] = self.trace_options.to_dict()
|
@@ -105,26 +132,28 @@ class MapMatchRequest(BaseModel):
|
|
105
132
|
return _dict
|
106
133
|
|
107
134
|
@classmethod
|
108
|
-
def from_dict(cls, obj:
|
135
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
109
136
|
"""Create an instance of MapMatchRequest from a dict"""
|
110
137
|
if obj is None:
|
111
138
|
return None
|
112
139
|
|
113
140
|
if not isinstance(obj, dict):
|
114
|
-
return
|
141
|
+
return cls.model_validate(obj)
|
115
142
|
|
116
|
-
_obj =
|
143
|
+
_obj = cls.model_validate({
|
117
144
|
"id": obj.get("id"),
|
118
|
-
"shape": [MapMatchWaypoint.from_dict(_item) for _item in obj
|
145
|
+
"shape": [MapMatchWaypoint.from_dict(_item) for _item in obj["shape"]] if obj.get("shape") is not None else None,
|
119
146
|
"encoded_polyline": obj.get("encoded_polyline"),
|
120
147
|
"costing": obj.get("costing"),
|
121
|
-
"costing_options": CostingOptions.from_dict(obj
|
148
|
+
"costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
|
122
149
|
"shape_match": obj.get("shape_match"),
|
123
|
-
"
|
150
|
+
"units": obj.get("units"),
|
151
|
+
"language": obj.get("language"),
|
152
|
+
"directions_type": obj.get("directions_type") if obj.get("directions_type") is not None else 'instructions',
|
124
153
|
"begin_time": obj.get("begin_time"),
|
125
154
|
"durations": obj.get("durations"),
|
126
155
|
"use_timestamps": obj.get("use_timestamps") if obj.get("use_timestamps") is not None else False,
|
127
|
-
"trace_options": MapMatchTraceOptions.from_dict(obj
|
156
|
+
"trace_options": MapMatchTraceOptions.from_dict(obj["trace_options"]) if obj.get("trace_options") is not None else None,
|
128
157
|
"linear_references": obj.get("linear_references") if obj.get("linear_references") is not None else False
|
129
158
|
})
|
130
159
|
# store additional fields in additional_properties
|
@@ -134,3 +163,4 @@ class MapMatchRequest(BaseModel):
|
|
134
163
|
|
135
164
|
return _obj
|
136
165
|
|
166
|
+
|
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,49 +18,75 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import List, Optional
|
23
|
-
from
|
24
|
-
from stadiamaps.models.
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from stadiamaps.models.route_response_alternates_inner import RouteResponseAlternatesInner
|
24
|
+
from stadiamaps.models.route_trip import RouteTrip
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
25
27
|
|
26
28
|
class MapMatchRouteResponse(BaseModel):
|
27
29
|
"""
|
28
30
|
MapMatchRouteResponse
|
29
|
-
"""
|
30
|
-
id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
|
31
|
-
trip:
|
32
|
-
|
31
|
+
""" # noqa: E501
|
32
|
+
id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
|
33
|
+
trip: RouteTrip
|
34
|
+
alternates: Optional[List[RouteResponseAlternatesInner]] = None
|
35
|
+
linear_references: Optional[List[StrictStr]] = None
|
33
36
|
additional_properties: Dict[str, Any] = {}
|
34
|
-
__properties = ["id", "trip", "linear_references"]
|
37
|
+
__properties: ClassVar[List[str]] = ["id", "trip", "alternates", "linear_references"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
35
44
|
|
36
|
-
class Config:
|
37
|
-
"""Pydantic configuration"""
|
38
|
-
allow_population_by_field_name = True
|
39
|
-
validate_assignment = True
|
40
45
|
|
41
46
|
def to_str(self) -> str:
|
42
47
|
"""Returns the string representation of the model using alias"""
|
43
|
-
return pprint.pformat(self.
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
49
|
|
45
50
|
def to_json(self) -> str:
|
46
51
|
"""Returns the JSON representation of the model using alias"""
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
47
53
|
return json.dumps(self.to_dict())
|
48
54
|
|
49
55
|
@classmethod
|
50
|
-
def from_json(cls, json_str: str) ->
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
51
57
|
"""Create an instance of MapMatchRouteResponse from a JSON string"""
|
52
58
|
return cls.from_dict(json.loads(json_str))
|
53
59
|
|
54
|
-
def to_dict(self):
|
55
|
-
"""
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
62
|
+
|
63
|
+
This has the following differences from calling pydantic's
|
64
|
+
`self.model_dump(by_alias=True)`:
|
65
|
+
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
67
|
+
were set at model initialization. Other fields with value `None`
|
68
|
+
are ignored.
|
69
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
70
|
+
"""
|
71
|
+
excluded_fields: Set[str] = set([
|
72
|
+
"additional_properties",
|
73
|
+
])
|
74
|
+
|
75
|
+
_dict = self.model_dump(
|
76
|
+
by_alias=True,
|
77
|
+
exclude=excluded_fields,
|
78
|
+
exclude_none=True,
|
79
|
+
)
|
61
80
|
# override the default output from pydantic by calling `to_dict()` of trip
|
62
81
|
if self.trip:
|
63
82
|
_dict['trip'] = self.trip.to_dict()
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of each item in alternates (list)
|
84
|
+
_items = []
|
85
|
+
if self.alternates:
|
86
|
+
for _item in self.alternates:
|
87
|
+
if _item:
|
88
|
+
_items.append(_item.to_dict())
|
89
|
+
_dict['alternates'] = _items
|
64
90
|
# puts key-value pairs in additional_properties in the top level
|
65
91
|
if self.additional_properties is not None:
|
66
92
|
for _key, _value in self.additional_properties.items():
|
@@ -69,17 +95,18 @@ class MapMatchRouteResponse(BaseModel):
|
|
69
95
|
return _dict
|
70
96
|
|
71
97
|
@classmethod
|
72
|
-
def from_dict(cls, obj:
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
73
99
|
"""Create an instance of MapMatchRouteResponse from a dict"""
|
74
100
|
if obj is None:
|
75
101
|
return None
|
76
102
|
|
77
103
|
if not isinstance(obj, dict):
|
78
|
-
return
|
104
|
+
return cls.model_validate(obj)
|
79
105
|
|
80
|
-
_obj =
|
106
|
+
_obj = cls.model_validate({
|
81
107
|
"id": obj.get("id"),
|
82
|
-
"trip":
|
108
|
+
"trip": RouteTrip.from_dict(obj["trip"]) if obj.get("trip") is not None else None,
|
109
|
+
"alternates": [RouteResponseAlternatesInner.from_dict(_item) for _item in obj["alternates"]] if obj.get("alternates") is not None else None,
|
83
110
|
"linear_references": obj.get("linear_references")
|
84
111
|
})
|
85
112
|
# store additional fields in additional_properties
|
@@ -89,3 +116,4 @@ class MapMatchRouteResponse(BaseModel):
|
|
89
116
|
|
90
117
|
return _obj
|
91
118
|
|
119
|
+
|
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,47 +18,64 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Optional, Union
|
23
|
-
from
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
24
25
|
|
25
26
|
class MapMatchTraceOptions(BaseModel):
|
26
27
|
"""
|
27
28
|
MapMatchTraceOptions
|
28
|
-
"""
|
29
|
-
search_radius: Optional[StrictInt] = Field(None, description="The search radius, in meters, when trying to match each trace point.")
|
30
|
-
gps_accuracy: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The accuracy of the GPS, in meters.")
|
31
|
-
breakage_distance: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The breaking distance, in meters, between trace points.")
|
32
|
-
interpolation_distance: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The interpolation distance, in meters, beyond which trace points are merged together.")
|
33
|
-
turn_penalty_factor: Optional[StrictInt] = Field(None, description="Penalizes turns from one road segment to next. For a pedestrian trace, you may see a back-and-forth motion along the streets of your path with the default settings. Try increasing the turn penalty factor to 500 to reduce jitter in the output. Note that if GPS accuracy is already good, increasing this above the default will usually negatively affect the quality of map matching.")
|
29
|
+
""" # noqa: E501
|
30
|
+
search_radius: Optional[StrictInt] = Field(default=None, description="The search radius, in meters, when trying to match each trace point.")
|
31
|
+
gps_accuracy: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The accuracy of the GPS, in meters.")
|
32
|
+
breakage_distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The breaking distance, in meters, between trace points.")
|
33
|
+
interpolation_distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The interpolation distance, in meters, beyond which trace points are merged together.")
|
34
|
+
turn_penalty_factor: Optional[StrictInt] = Field(default=None, description="Penalizes turns from one road segment to next. For a pedestrian trace, you may see a back-and-forth motion along the streets of your path with the default settings. Try increasing the turn penalty factor to 500 to reduce jitter in the output. Note that if GPS accuracy is already good, increasing this above the default will usually negatively affect the quality of map matching.")
|
34
35
|
additional_properties: Dict[str, Any] = {}
|
35
|
-
__properties = ["search_radius", "gps_accuracy", "breakage_distance", "interpolation_distance", "turn_penalty_factor"]
|
36
|
+
__properties: ClassVar[List[str]] = ["search_radius", "gps_accuracy", "breakage_distance", "interpolation_distance", "turn_penalty_factor"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
36
43
|
|
37
|
-
class Config:
|
38
|
-
"""Pydantic configuration"""
|
39
|
-
allow_population_by_field_name = True
|
40
|
-
validate_assignment = True
|
41
44
|
|
42
45
|
def to_str(self) -> str:
|
43
46
|
"""Returns the string representation of the model using alias"""
|
44
|
-
return pprint.pformat(self.
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
45
48
|
|
46
49
|
def to_json(self) -> str:
|
47
50
|
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
52
|
return json.dumps(self.to_dict())
|
49
53
|
|
50
54
|
@classmethod
|
51
|
-
def from_json(cls, json_str: str) ->
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
56
|
"""Create an instance of MapMatchTraceOptions from a JSON string"""
|
53
57
|
return cls.from_dict(json.loads(json_str))
|
54
58
|
|
55
|
-
def to_dict(self):
|
56
|
-
"""
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
69
|
+
"""
|
70
|
+
excluded_fields: Set[str] = set([
|
71
|
+
"additional_properties",
|
72
|
+
])
|
73
|
+
|
74
|
+
_dict = self.model_dump(
|
75
|
+
by_alias=True,
|
76
|
+
exclude=excluded_fields,
|
77
|
+
exclude_none=True,
|
78
|
+
)
|
62
79
|
# puts key-value pairs in additional_properties in the top level
|
63
80
|
if self.additional_properties is not None:
|
64
81
|
for _key, _value in self.additional_properties.items():
|
@@ -67,15 +84,15 @@ class MapMatchTraceOptions(BaseModel):
|
|
67
84
|
return _dict
|
68
85
|
|
69
86
|
@classmethod
|
70
|
-
def from_dict(cls, obj:
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
71
88
|
"""Create an instance of MapMatchTraceOptions from a dict"""
|
72
89
|
if obj is None:
|
73
90
|
return None
|
74
91
|
|
75
92
|
if not isinstance(obj, dict):
|
76
|
-
return
|
93
|
+
return cls.model_validate(obj)
|
77
94
|
|
78
|
-
_obj =
|
95
|
+
_obj = cls.model_validate({
|
79
96
|
"search_radius": obj.get("search_radius"),
|
80
97
|
"gps_accuracy": obj.get("gps_accuracy"),
|
81
98
|
"breakage_distance": obj.get("breakage_distance"),
|
@@ -89,3 +106,4 @@ class MapMatchTraceOptions(BaseModel):
|
|
89
106
|
|
90
107
|
return _obj
|
91
108
|
|
109
|
+
|
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,56 +18,74 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Optional, Union
|
23
|
-
from
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
|
+
from typing_extensions import Annotated
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
24
26
|
|
25
27
|
class MapMatchWaypoint(BaseModel):
|
26
28
|
"""
|
27
29
|
MapMatchWaypoint
|
28
|
-
"""
|
29
|
-
lat: Union[
|
30
|
-
lon: Union[
|
31
|
-
type: Optional[StrictStr] = Field('break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
|
32
|
-
time: Optional[StrictInt] = Field(None, description="The timestamp of the waypoint, in seconds. This can inform the map matching algorithm about when the point was measured. A UNIX timestamp, or any increasing integer sequence measuring seconds from some reference point can be used.")
|
30
|
+
""" # noqa: E501
|
31
|
+
lat: Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]] = Field(description="The latitude of a point in the shape.")
|
32
|
+
lon: Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]] = Field(description="The longitude of a point in the shape.")
|
33
|
+
type: Optional[StrictStr] = Field(default='break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
|
34
|
+
time: Optional[StrictInt] = Field(default=None, description="The timestamp of the waypoint, in seconds. This can inform the map matching algorithm about when the point was measured. A UNIX timestamp, or any increasing integer sequence measuring seconds from some reference point can be used.")
|
33
35
|
additional_properties: Dict[str, Any] = {}
|
34
|
-
__properties = ["lat", "lon", "type", "time"]
|
36
|
+
__properties: ClassVar[List[str]] = ["lat", "lon", "type", "time"]
|
35
37
|
|
36
|
-
@
|
38
|
+
@field_validator('type')
|
37
39
|
def type_validate_enum(cls, value):
|
38
40
|
"""Validates the enum"""
|
39
41
|
if value is None:
|
40
42
|
return value
|
41
43
|
|
42
|
-
if value not in ('break', 'through', 'via', 'break_through'):
|
44
|
+
if value not in set(['break', 'through', 'via', 'break_through']):
|
43
45
|
raise ValueError("must be one of enum values ('break', 'through', 'via', 'break_through')")
|
44
46
|
return value
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
model_config = ConfigDict(
|
49
|
+
populate_by_name=True,
|
50
|
+
validate_assignment=True,
|
51
|
+
protected_namespaces=(),
|
52
|
+
)
|
53
|
+
|
50
54
|
|
51
55
|
def to_str(self) -> str:
|
52
56
|
"""Returns the string representation of the model using alias"""
|
53
|
-
return pprint.pformat(self.
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
54
58
|
|
55
59
|
def to_json(self) -> str:
|
56
60
|
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
62
|
return json.dumps(self.to_dict())
|
58
63
|
|
59
64
|
@classmethod
|
60
|
-
def from_json(cls, json_str: str) ->
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
66
|
"""Create an instance of MapMatchWaypoint from a JSON string"""
|
62
67
|
return cls.from_dict(json.loads(json_str))
|
63
68
|
|
64
|
-
def to_dict(self):
|
65
|
-
"""
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
79
|
+
"""
|
80
|
+
excluded_fields: Set[str] = set([
|
81
|
+
"additional_properties",
|
82
|
+
])
|
83
|
+
|
84
|
+
_dict = self.model_dump(
|
85
|
+
by_alias=True,
|
86
|
+
exclude=excluded_fields,
|
87
|
+
exclude_none=True,
|
88
|
+
)
|
71
89
|
# puts key-value pairs in additional_properties in the top level
|
72
90
|
if self.additional_properties is not None:
|
73
91
|
for _key, _value in self.additional_properties.items():
|
@@ -76,15 +94,15 @@ class MapMatchWaypoint(BaseModel):
|
|
76
94
|
return _dict
|
77
95
|
|
78
96
|
@classmethod
|
79
|
-
def from_dict(cls, obj:
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
80
98
|
"""Create an instance of MapMatchWaypoint from a dict"""
|
81
99
|
if obj is None:
|
82
100
|
return None
|
83
101
|
|
84
102
|
if not isinstance(obj, dict):
|
85
|
-
return
|
103
|
+
return cls.model_validate(obj)
|
86
104
|
|
87
|
-
_obj =
|
105
|
+
_obj = cls.model_validate({
|
88
106
|
"lat": obj.get("lat"),
|
89
107
|
"lon": obj.get("lon"),
|
90
108
|
"type": obj.get("type") if obj.get("type") is not None else 'break',
|
@@ -97,3 +115,4 @@ class MapMatchWaypoint(BaseModel):
|
|
97
115
|
|
98
116
|
return _obj
|
99
117
|
|
118
|
+
|