stadiamaps 4.0.0__py3-none-any.whl → 6.0.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.
Files changed (164) hide show
  1. stadiamaps/__init__.py +32 -14
  2. stadiamaps/api/geocoding_api.py +976 -153
  3. stadiamaps/api/geospatial_api.py +7 -3
  4. stadiamaps/api/routing_api.py +22 -8
  5. stadiamaps/api_client.py +15 -6
  6. stadiamaps/configuration.py +156 -40
  7. stadiamaps/exceptions.py +18 -1
  8. stadiamaps/models/__init__.py +31 -13
  9. stadiamaps/models/access.py +1 -1
  10. stadiamaps/models/addendum_v2.py +143 -0
  11. stadiamaps/models/address_components_v2.py +134 -0
  12. stadiamaps/models/admin_region.py +1 -1
  13. stadiamaps/models/administrative.py +1 -1
  14. stadiamaps/models/annotation_filters.py +1 -1
  15. stadiamaps/models/auto_costing_options.py +1 -1
  16. stadiamaps/models/base_costing_options.py +1 -1
  17. stadiamaps/models/base_trace_request.py +4 -4
  18. stadiamaps/models/bicycle_costing_options.py +1 -1
  19. stadiamaps/models/bike_network.py +1 -1
  20. stadiamaps/models/bulk_request.py +1 -1
  21. stadiamaps/models/bulk_request_query.py +1 -1
  22. stadiamaps/models/bulk_search_response.py +4 -4
  23. stadiamaps/models/context.py +119 -0
  24. stadiamaps/models/contour.py +1 -1
  25. stadiamaps/models/coordinate.py +1 -1
  26. stadiamaps/models/costing_model.py +1 -1
  27. stadiamaps/models/costing_options.py +1 -1
  28. stadiamaps/models/directions_options.py +4 -4
  29. stadiamaps/models/distance_unit.py +1 -1
  30. stadiamaps/models/edge_sign.py +1 -1
  31. stadiamaps/models/edge_use.py +1 -1
  32. stadiamaps/models/end_node.py +1 -1
  33. stadiamaps/models/extended_directions_options.py +1 -1
  34. stadiamaps/models/feature_properties_v2.py +126 -0
  35. stadiamaps/models/feature_properties_v2_properties.py +184 -0
  36. stadiamaps/models/foursquare_addendum.py +113 -0
  37. stadiamaps/models/geo_attributes.py +1 -1
  38. stadiamaps/models/geo_json_geometry.py +1 -1
  39. stadiamaps/models/geo_json_geometry_base.py +1 -1
  40. stadiamaps/models/geo_json_line_string.py +1 -1
  41. stadiamaps/models/geo_json_point.py +1 -1
  42. stadiamaps/models/geo_json_polygon.py +1 -1
  43. stadiamaps/models/{pelias_response.py → geocode_response.py} +8 -8
  44. stadiamaps/models/geocode_response_envelope_properties_v2.py +125 -0
  45. stadiamaps/models/{pelias_geo_json_feature.py → geocoding_geo_json_feature.py} +8 -8
  46. stadiamaps/models/{pelias_geo_json_properties.py → geocoding_geo_json_properties.py} +43 -15
  47. stadiamaps/models/{pelias_geo_json_properties_addendum.py → geocoding_geo_json_properties_addendum.py} +7 -7
  48. stadiamaps/models/{pelias_geo_json_properties_addendum_osm.py → geocoding_geo_json_properties_addendum_osm.py} +5 -5
  49. stadiamaps/models/{pelias_layer.py → geocoding_layer.py} +3 -3
  50. stadiamaps/models/geocoding_meta.py +108 -0
  51. stadiamaps/models/geocoding_object.py +1 -1
  52. stadiamaps/models/{pelias_source.py → geocoding_source.py} +4 -3
  53. stadiamaps/models/geonames_addendum.py +101 -0
  54. stadiamaps/models/height_request.py +1 -1
  55. stadiamaps/models/height_response.py +1 -1
  56. stadiamaps/models/highway_classification.py +1 -1
  57. stadiamaps/models/intersecting_edge.py +1 -1
  58. stadiamaps/models/isochrone_costing_model.py +1 -1
  59. stadiamaps/models/isochrone_feature.py +1 -1
  60. stadiamaps/models/isochrone_properties.py +1 -1
  61. stadiamaps/models/isochrone_request.py +1 -1
  62. stadiamaps/models/isochrone_response.py +1 -1
  63. stadiamaps/models/layer_id.py +57 -0
  64. stadiamaps/models/locate_detailed_edge.py +1 -1
  65. stadiamaps/models/locate_edge.py +1 -1
  66. stadiamaps/models/locate_edge_info.py +1 -1
  67. stadiamaps/models/locate_node.py +1 -1
  68. stadiamaps/models/locate_object.py +1 -1
  69. stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
  70. stadiamaps/models/maneuver_sign.py +1 -1
  71. stadiamaps/models/maneuver_sign_element.py +1 -1
  72. stadiamaps/models/map_match_costing_model.py +1 -1
  73. stadiamaps/models/map_match_request.py +10 -8
  74. stadiamaps/models/map_match_route_response.py +1 -1
  75. stadiamaps/models/map_match_trace_options.py +1 -1
  76. stadiamaps/models/map_match_waypoint.py +3 -3
  77. stadiamaps/models/match_type.py +39 -0
  78. stadiamaps/models/matched_point.py +1 -1
  79. stadiamaps/models/matrix_costing_model.py +1 -1
  80. stadiamaps/models/matrix_distance.py +1 -1
  81. stadiamaps/models/matrix_request.py +4 -4
  82. stadiamaps/models/matrix_response.py +4 -4
  83. stadiamaps/models/matrix_waypoint.py +1 -1
  84. stadiamaps/models/motor_scooter_costing_options.py +1 -1
  85. stadiamaps/models/motorcycle_costing_options.py +1 -1
  86. stadiamaps/models/nearest_roads_request.py +4 -4
  87. stadiamaps/models/node_id.py +1 -1
  88. stadiamaps/models/node_type.py +1 -1
  89. stadiamaps/models/open_street_map_addendum.py +162 -0
  90. stadiamaps/models/optimized_route_request.py +10 -8
  91. stadiamaps/models/osrm_admin.py +1 -1
  92. stadiamaps/models/osrm_annotation.py +1 -1
  93. stadiamaps/models/osrm_banner_component.py +1 -1
  94. stadiamaps/models/osrm_banner_content.py +1 -1
  95. stadiamaps/models/osrm_banner_instruction.py +1 -1
  96. stadiamaps/models/osrm_base_api_response.py +1 -1
  97. stadiamaps/models/osrm_guidance_modifier.py +1 -1
  98. stadiamaps/models/osrm_intersection.py +1 -1
  99. stadiamaps/models/osrm_lane.py +1 -1
  100. stadiamaps/models/osrm_route.py +1 -1
  101. stadiamaps/models/osrm_route_leg.py +1 -1
  102. stadiamaps/models/osrm_route_response.py +1 -1
  103. stadiamaps/models/osrm_route_step.py +1 -1
  104. stadiamaps/models/osrm_speed_limit.py +1 -1
  105. stadiamaps/models/osrm_step_maneuver.py +1 -1
  106. stadiamaps/models/osrm_via_waypoint.py +1 -1
  107. stadiamaps/models/osrm_voice_instruction.py +1 -1
  108. stadiamaps/models/osrm_waypoint.py +1 -1
  109. stadiamaps/models/pedestrian_costing_options.py +8 -5
  110. stadiamaps/models/pedestrian_type.py +39 -0
  111. stadiamaps/models/point.py +104 -0
  112. stadiamaps/models/precision.py +38 -0
  113. stadiamaps/models/properties_v2.py +184 -0
  114. stadiamaps/models/restrictions.py +11 -11
  115. stadiamaps/models/road_class.py +1 -1
  116. stadiamaps/models/route200_response.py +1 -1
  117. stadiamaps/models/route_leg.py +1 -1
  118. stadiamaps/models/route_maneuver.py +1 -1
  119. stadiamaps/models/route_request.py +5 -5
  120. stadiamaps/models/route_response.py +1 -1
  121. stadiamaps/models/route_response_alternates_inner.py +1 -1
  122. stadiamaps/models/route_summary.py +1 -1
  123. stadiamaps/models/route_trip.py +7 -7
  124. stadiamaps/models/{valhalla_languages.py → routing_languages.py} +4 -4
  125. stadiamaps/models/{valhalla_long_units.py → routing_long_units.py} +4 -4
  126. stadiamaps/models/routing_response_waypoint.py +3 -3
  127. stadiamaps/models/routing_waypoint.py +3 -3
  128. stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
  129. stadiamaps/models/search_query.py +7 -7
  130. stadiamaps/models/search_structured_query.py +8 -8
  131. stadiamaps/models/simple_routing_waypoint.py +3 -3
  132. stadiamaps/models/source_attribution.py +110 -0
  133. stadiamaps/models/source_id.py +41 -0
  134. stadiamaps/models/speeds.py +1 -1
  135. stadiamaps/models/trace_attribute_filter_options.py +1 -1
  136. stadiamaps/models/trace_attribute_key.py +1 -1
  137. stadiamaps/models/trace_attributes_base_response.py +1 -1
  138. stadiamaps/models/trace_attributes_request.py +10 -8
  139. stadiamaps/models/trace_attributes_response.py +4 -9
  140. stadiamaps/models/trace_edge.py +2 -7
  141. stadiamaps/models/travel_mode.py +1 -1
  142. stadiamaps/models/traversability.py +1 -1
  143. stadiamaps/models/truck_costing_options.py +1 -1
  144. stadiamaps/models/tz_response.py +1 -1
  145. stadiamaps/models/warning.py +1 -1
  146. stadiamaps/models/whos_on_first_concordances.py +246 -0
  147. stadiamaps/models/wof_context.py +210 -0
  148. stadiamaps/models/wof_context_component.py +110 -0
  149. stadiamaps/rest.py +2 -2
  150. stadiamaps-6.0.0.dist-info/METADATA +117 -0
  151. stadiamaps-6.0.0.dist-info/RECORD +183 -0
  152. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info}/WHEEL +1 -1
  153. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info}/top_level.txt +1 -0
  154. test/integration/__init__.py +0 -0
  155. test/integration/test_eu_endpoint.py +21 -0
  156. test/integration/test_gecoding.py +112 -0
  157. test/integration/test_geospatial.py +43 -0
  158. test/integration/test_routing.py +282 -0
  159. stadiamaps/models/pelias_response_geocoding.py +0 -89
  160. stadiamaps/models/route_response_trip.py +0 -117
  161. stadiamaps/models/trace_attributes_response_all_of.py +0 -96
  162. stadiamaps-4.0.0.dist-info/METADATA +0 -79
  163. stadiamaps-4.0.0.dist-info/RECORD +0 -160
  164. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info/licenses}/LICENSE.txt +0 -0
@@ -0,0 +1,282 @@
1
+ import os
2
+ import unittest
3
+
4
+ import stadiamaps
5
+ from stadiamaps import AnnotationFilters
6
+
7
+ location_a = {"lat": 40.042072, "lon": -76.306572}
8
+ location_b = {"lat": 39.992115, "lon": -76.781559}
9
+ location_c = {"lat": 39.984519, "lon": -76.6956}
10
+
11
+
12
+ class TestRouting(unittest.TestCase):
13
+ def setUp(self):
14
+ self.configuration = stadiamaps.Configuration()
15
+ self.configuration.api_key["ApiKeyAuth"] = os.environ["STADIA_API_KEY"]
16
+
17
+ def tearDown(self):
18
+ pass
19
+
20
+ def testRoute(self):
21
+ with stadiamaps.ApiClient(self.configuration) as api_client:
22
+ api_instance = stadiamaps.RoutingApi(api_client)
23
+
24
+ req = stadiamaps.RouteRequest(
25
+ id="route",
26
+ locations=[
27
+ stadiamaps.RoutingWaypoint.from_dict(location_a),
28
+ stadiamaps.RoutingWaypoint.from_dict(location_b)
29
+ ],
30
+ costing=stadiamaps.CostingModel.AUTO,
31
+ costing_options=stadiamaps.CostingOptions(auto=stadiamaps.AutoCostingOptions(use_tolls=0.7)),
32
+ units=stadiamaps.DistanceUnit.MI,
33
+ )
34
+
35
+ res = api_instance.route(req).actual_instance
36
+ self.assertEqual(req.id, res.id)
37
+ self.assertEqual(0, res.trip.status)
38
+ self.assertEqual("miles", res.trip.units)
39
+ self.assertEqual(len(res.trip.legs), 1)
40
+ self.assertEqual(len(res.alternates or []), 0)
41
+
42
+ def testNavigationRoute(self):
43
+ with stadiamaps.ApiClient(self.configuration) as api_client:
44
+ api_instance = stadiamaps.RoutingApi(api_client)
45
+
46
+ req = stadiamaps.RouteRequest(
47
+ id="route",
48
+ locations=[
49
+ stadiamaps.RoutingWaypoint.from_dict(location_a),
50
+ stadiamaps.RoutingWaypoint.from_dict(location_b)
51
+ ],
52
+ costing=stadiamaps.CostingModel.AUTO,
53
+ costing_options=stadiamaps.CostingOptions(auto=stadiamaps.AutoCostingOptions(use_tolls=0.7)),
54
+ units=stadiamaps.DistanceUnit.MI,
55
+ format="osrm",
56
+ banner_instructions=True,
57
+ filters=AnnotationFilters(action="include", attributes=["shape_attributes.speed_limit"])
58
+ )
59
+
60
+ res = api_instance.route(req).actual_instance
61
+ self.assertEqual("Ok", res.code)
62
+ self.assertEqual(len(res.routes), 1)
63
+ has_banner_instructions = False
64
+ for step in res.routes[0].legs[0].steps:
65
+ if len(step.banner_instructions) > 0:
66
+ has_banner_instructions = True
67
+
68
+ self.assertTrue(has_banner_instructions)
69
+
70
+ def testRouteWithAlternates(self):
71
+ with stadiamaps.ApiClient(self.configuration) as api_client:
72
+ api_instance = stadiamaps.RoutingApi(api_client)
73
+
74
+ req = stadiamaps.RouteRequest(
75
+ id="route",
76
+ locations=[
77
+ stadiamaps.RoutingWaypoint.from_dict(location_a),
78
+ stadiamaps.RoutingWaypoint.from_dict(location_b)
79
+ ],
80
+ costing=stadiamaps.CostingModel.AUTO,
81
+ costing_options=stadiamaps.CostingOptions(auto=stadiamaps.AutoCostingOptions(use_tolls=0.7)),
82
+ units=stadiamaps.DistanceUnit.MI,
83
+ alternates=1,
84
+ )
85
+
86
+ res = api_instance.route(req).actual_instance
87
+ self.assertEqual(req.id, res.id)
88
+ self.assertEqual(0, res.trip.status)
89
+ self.assertEqual("miles", res.trip.units)
90
+ self.assertEqual(len(res.trip.legs), 1)
91
+ self.assertEqual(len(res.alternates), 1)
92
+
93
+ def testRouteWithElevation(self):
94
+ with stadiamaps.ApiClient(self.configuration) as api_client:
95
+ api_instance = stadiamaps.RoutingApi(api_client)
96
+
97
+ req = stadiamaps.RouteRequest(
98
+ id="route",
99
+ locations=[
100
+ stadiamaps.RoutingWaypoint.from_dict(location_a),
101
+ stadiamaps.RoutingWaypoint.from_dict(location_b)
102
+ ],
103
+ costing=stadiamaps.CostingModel.AUTO,
104
+ costing_options=stadiamaps.CostingOptions(auto=stadiamaps.AutoCostingOptions(use_tolls=0.7)),
105
+ units=stadiamaps.DistanceUnit.MI,
106
+ elevation_interval=30,
107
+ )
108
+
109
+ res = api_instance.route(req).actual_instance
110
+ self.assertEqual(req.id, res.id)
111
+ self.assertEqual(0, res.trip.status)
112
+ self.assertEqual("miles", res.trip.units)
113
+ self.assertEqual(len(res.trip.legs), 1)
114
+ self.assertGreater(len(res.trip.legs[0].elevation), 1)
115
+
116
+ def testHybridBicycleRoute(self):
117
+ # Regression test for user-reported issue
118
+ with stadiamaps.ApiClient(self.configuration) as api_client:
119
+ api_instance = stadiamaps.RoutingApi(api_client)
120
+
121
+ req = stadiamaps.RouteRequest(
122
+ id="route",
123
+ locations=[
124
+ stadiamaps.RoutingWaypoint.from_dict(location_a),
125
+ stadiamaps.RoutingWaypoint.from_dict(location_b)
126
+ ],
127
+ costing=stadiamaps.CostingModel.BICYCLE,
128
+ costing_options=stadiamaps.CostingOptions(
129
+ bicycle=stadiamaps.BicycleCostingOptions(bicycle_type='Hybrid', use_roads=0.4, use_hills=0.6)),
130
+ units=stadiamaps.DistanceUnit.KM,
131
+ )
132
+
133
+ res = api_instance.route(req).actual_instance
134
+ self.assertEqual(req.id, res.id)
135
+ self.assertEqual(0, res.trip.status)
136
+ self.assertEqual("kilometers", res.trip.units)
137
+ self.assertEqual(len(res.trip.legs), 1)
138
+
139
+ def testOptimizedRoute(self):
140
+ with stadiamaps.ApiClient(self.configuration) as api_client:
141
+ api_instance = stadiamaps.RoutingApi(api_client)
142
+
143
+ req = stadiamaps.OptimizedRouteRequest(
144
+ id="optimized_route",
145
+ locations=[
146
+ stadiamaps.Coordinate.from_dict(location_a),
147
+ stadiamaps.Coordinate.from_dict(location_b),
148
+ stadiamaps.Coordinate.from_dict(location_c),
149
+ stadiamaps.Coordinate.from_dict(location_a),
150
+ ],
151
+ costing=stadiamaps.MatrixCostingModel.AUTO,
152
+ costing_options=stadiamaps.CostingOptions(auto=stadiamaps.AutoCostingOptions(use_tolls=0.7)),
153
+ units=stadiamaps.DistanceUnit.MI,
154
+ )
155
+
156
+ res = api_instance.optimized_route(req).actual_instance
157
+ self.assertEqual(req.id, res.id)
158
+ self.assertEqual(0, res.trip.status)
159
+ self.assertEqual("miles", res.trip.units)
160
+ self.assertGreater(len(res.trip.legs), 1)
161
+
162
+ def testTimeDistanceMatrix(self):
163
+ with stadiamaps.ApiClient(self.configuration) as api_client:
164
+ api_instance = stadiamaps.RoutingApi(api_client)
165
+
166
+ req = stadiamaps.MatrixRequest(
167
+ id="matrix",
168
+ sources=[
169
+ stadiamaps.MatrixWaypoint.from_dict(location_a),
170
+ ],
171
+ targets=[
172
+ stadiamaps.MatrixWaypoint.from_dict(location_b),
173
+ stadiamaps.MatrixWaypoint.from_dict(location_c),
174
+ ],
175
+ costing=stadiamaps.MatrixCostingModel.PEDESTRIAN,
176
+ )
177
+
178
+ res = api_instance.time_distance_matrix(req)
179
+ self.assertEqual(req.id, res.id)
180
+ self.assertEqual(len(req.sources), len(res.sources))
181
+ self.assertEqual(len(req.targets), len(res.targets))
182
+ self.assertGreater(len(res.sources_to_targets[0]), 1)
183
+ self.assertEqual("kilometers", res.units)
184
+
185
+ def testTimeDistanceMatrixWithUnroutableLegs(self):
186
+ with stadiamaps.ApiClient(self.configuration) as api_client:
187
+ api_instance = stadiamaps.RoutingApi(api_client)
188
+
189
+ # At least one of these is not routable; make sure we handle it gracefully
190
+ req = stadiamaps.MatrixRequest(
191
+ id="matrix",
192
+ sources=[
193
+ stadiamaps.MatrixWaypoint.from_dict({
194
+ "lon": 22.726262,
195
+ "lat": 58.891957
196
+ }),
197
+ stadiamaps.MatrixWaypoint.from_dict({
198
+ "lon": 23.762758,
199
+ "lat": 59.1558
200
+ }),
201
+ ],
202
+ targets=[
203
+ stadiamaps.MatrixWaypoint.from_dict({
204
+ "lon": 23.846605,
205
+ "lat": 59.176153
206
+ }),
207
+ stadiamaps.MatrixWaypoint.from_dict({
208
+ "lon": 23.096114,
209
+ "lat": 59.562853
210
+ }),
211
+ ],
212
+ costing=stadiamaps.MatrixCostingModel.BICYCLE,
213
+ )
214
+
215
+ res = api_instance.time_distance_matrix(req)
216
+ self.assertEqual(req.id, res.id)
217
+ self.assertEqual(len(req.sources), len(res.sources))
218
+ self.assertGreater(len(res.sources_to_targets[0]), 1)
219
+ self.assertEqual("kilometers", res.units)
220
+
221
+ def testNearestRoads(self):
222
+ with stadiamaps.ApiClient(self.configuration) as api_client:
223
+ api_instance = stadiamaps.RoutingApi(api_client)
224
+
225
+ req = stadiamaps.NearestRoadsRequest(
226
+ locations=[stadiamaps.Coordinate.from_dict(loc) for loc in (location_a, location_b, location_c)]
227
+ )
228
+ res = api_instance.nearest_roads(req)
229
+ self.assertEqual(len(res), 3)
230
+ self.assertGreaterEqual(len(res[0].edges), 1)
231
+
232
+ def testIsochrone(self):
233
+ with stadiamaps.ApiClient(self.configuration) as api_client:
234
+ api_instance = stadiamaps.RoutingApi(api_client)
235
+
236
+ req = stadiamaps.IsochroneRequest(
237
+ id="isochrone",
238
+ locations=[stadiamaps.Coordinate.from_dict(location_a)],
239
+ costing=stadiamaps.IsochroneCostingModel.PEDESTRIAN,
240
+ contours=[
241
+ stadiamaps.Contour(time=5, color="aabbcc")
242
+ ],
243
+ polygons=True,
244
+ )
245
+ res = api_instance.isochrone(req)
246
+ self.assertEqual(req.id, res.id)
247
+ self.assertGreaterEqual(len(res.features), 1)
248
+
249
+ def testMapMatch(self):
250
+ with stadiamaps.ApiClient(self.configuration) as api_client:
251
+ api_instance = stadiamaps.RoutingApi(api_client)
252
+
253
+ req = stadiamaps.MapMatchRequest(
254
+ id="map_match",
255
+ encoded_polyline="_grbgAh~{nhF?lBAzBFvBHxBEtBKdB?fB@dBZdBb@hBh@jBb@x@\\|@x@pB\\x@v@hBl@nBPbCXtBn@|@z@ZbAEbAa@~@q@z@QhA]pAUpAVhAPlAWtASpAAdA[dASdAQhAIlARjANnAZhAf@n@`A?lB^nCRbA\\xB`@vBf@tBTbCFbARzBZvBThBRnBNrBP`CHbCF`CNdCb@vBX`ARlAJfADhA@dAFdAP`AR`Ah@hBd@bBl@rBV|B?vB]tBCvBBhAF`CFnBXtAVxAVpAVtAb@|AZ`Bd@~BJfA@fAHdADhADhABjAGzAInAAjAB|BNbCR|BTjBZtB`@lBh@lB\\|Bl@rBXtBN`Al@g@t@?nAA~AKvACvAAlAMdAU`Ac@hAShAI`AJ`AIdAi@bAu@|@k@p@]p@a@bAc@z@g@~@Ot@Bz@f@X`BFtBXdCLbAf@zBh@fBb@xAb@nATjAKjAW`BI|AEpAHjAPdAAfAGdAFjAv@p@XlAVnA?~A?jAInAPtAVxAXnAf@tBDpBJpBXhBJfBDpAZ|Ax@pAz@h@~@lA|@bAnAd@hAj@tAR~AKxAc@xAShA]hAIdAAjA]~A[v@BhB?dBSv@Ct@CvAI~@Oz@Pv@dAz@lAj@~A^`B^|AXvAVpAXdBh@~Ap@fCh@hB\\zBN`Aj@xBFdA@jALbAPbAJdAHdAJbAHbAHfAJhALbA\\lBTvBAdC@bC@jCKjASbC?`CM`CDpB\\xAj@tB\\fA\\bAVfAJdAJbAXz@L|BO`AOdCDdA@~B\\z@l@v@l@v@l@r@j@t@b@x@b@r@z@jBVfCJdAJdANbCPfCF|BRhBS~BS`AYbAe@~BQdA",
256
+ costing=stadiamaps.MapMatchCostingModel.PEDESTRIAN,
257
+ units=stadiamaps.DistanceUnit.MI,
258
+ linear_references=True,
259
+ )
260
+ res = api_instance.map_match(req)
261
+ self.assertEqual(req.id, res.id)
262
+ self.assertEqual(0, res.trip.status)
263
+ self.assertEqual("miles", res.trip.units)
264
+ self.assertEqual(len(res.trip.legs), 1)
265
+
266
+ def testTraceAttributes(self):
267
+ with stadiamaps.ApiClient(self.configuration) as api_client:
268
+ api_instance = stadiamaps.RoutingApi(api_client)
269
+
270
+ req = stadiamaps.TraceAttributesRequest(
271
+ id="trace",
272
+ encoded_polyline="ge~jkAbakppC_AJ}_@hEsCZiCXuo@dH{l@pGuaBtPjBr`@`Bt]bDpu@FbDy@fEcAjEgOja@_BfE]zDoIzTaF~MwLtZsDjJwJ~ViF`N_DjI_AzBcDbIsJ~UqIvSqLvYoAzCwJdVmLjY_DzH_FzLuYls@aYhr@Uj@iCpGu@jBmLjYeJ~T_C|FoBzEkGrO}FtNaFxGkHpQeArHcGbOeEfK}D`K}Shi@uWxp@gMv[wBnFiAtCmMl[aB`EoKrW}Mj\\kDlI}K~WeBdEeHxPgF~LiBjE{BnF_EpJsD|I}Rte@sNp]Uj@aQ|b@w^||@_EtJi^`_AaC~F}Qnc@cHlOgA~B}DnIqG~M_NbXeO~X{O~X}\\nl@oFjJyRt\\iJ|NiGxJ{KbPeLtO_HhIyGjI_GbHc]v_@mNnOgWdYcFvFsGtFkBiEWg@cAfAqBnBnCnFaErDiTlSiWdV_O~N{QrOcFrE{IjIaGrC}G|IeEbGwDdGeDfGsDtHmDbIgI~SyEdMaBpEeB|E_BnEsLl\\qLj\\nxAfoA`Lr`ApB|Rz@`Lr@nLp@tJfCzW~Fhi@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E`J}B~Km@lD?lArAdFcEdHoDzGyFrJpXlw@rCOpCIbA`@dAdA|CrJvBlBtB@~D{AjB]~A^dBdDeAdAuGdFzElOte@b{AhAlF~@hEdQzk@zGpV`BhK|@|HdArGlBhGmAlAiMdH`EfYjInObG|E~K|EfGrB`P~D_IxD_HdBeErBn@pn@KfKPpFl@xAbBjBnC~Vl@pFdG|b@iFbBzNjcApZjiBzd@vmCvL~s@tHiCdFh]pBnKpAlI`S|iAbBzJhIoDpL~r@jXuJvDvKqEzDkBp@pCpKyPlKkHbEyHdFlDtV~DjUbDvRsEpDeBoJeCoN[dQsAfMuDpImH`GiE`Dqf@zv@}a@vq@iDlMib@br@oRvYyIrNi[vg@cC|DqDvPoS~dCgLre@mJ|RkEjHkIpKuJ|HkOfJse@bXg^|Qy^~ZiH`JeC`DeNhYw@~AkGdS{Gt]mGtr@gGbr@wAlh@mBdgAa@vUqD|oA{K~zCcLfxAaBrX`NbEvMlRwMmRaNcEGnA_@dMCnB?hU@fJTfL^bJfFSbC_EcC~DfJa@gJ`@gFR\\|Q^zSR`KYz[Izc@CdJK|[C~Mg@~N_@fN}@bQ}Ktt@aBvKyiFy}JgP|Uqg@ds@mD|D_yAhaByB`GgB|HaAtF[dH?hFH|HjAxGxBxG`CvDnXp^`PaX~HcJrp@_p@",
273
+ costing=stadiamaps.MapMatchCostingModel.PEDESTRIAN,
274
+ units=stadiamaps.DistanceUnit.MI,
275
+ )
276
+ res = api_instance.trace_attributes(req)
277
+ self.assertEqual(req.id, res.id)
278
+ self.assertEqual("miles", res.units)
279
+ self.assertGreaterEqual(len(res.admins), 1)
280
+ self.assertGreater(len(res.edges), 1)
281
+ self.assertGreater(len(res.matched_points), 1)
282
+ self.assertGreater(len(res.shape), 1)
@@ -1,89 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Stadia Maps Geospatial APIs
5
-
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
7
-
8
- The version of the OpenAPI document: 5.0.6
9
- Contact: support@stadiamaps.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
-
22
- from typing import Any, Dict, List, Optional
23
- from pydantic import BaseModel, Field, StrictStr, conlist
24
-
25
- class PeliasResponseGeocoding(BaseModel):
26
- """
27
- PeliasResponseGeocoding
28
- """
29
- attribution: Optional[StrictStr] = Field(None, description="A URL containing attribution information. If you are not using Stadia Maps and our standard attribution already for your basemaps, you must include this attribution link somewhere in your website/app.")
30
- query: Optional[Dict[str, Any]] = Field(None, description="Technical details of the query. This is most useful for debugging during development. See the full example for the list of properties; these should be self-explanatory, so we don't enumerate them in the spec.")
31
- warnings: Optional[conlist(StrictStr)] = Field(None, description="An array of non-critical warnings. This is normally for informational/debugging purposes and not a serious problem.")
32
- errors: Optional[conlist(StrictStr)] = Field(None, description="An array of more serious errors (for example, omitting a required parameter). Don’t ignore these.")
33
- additional_properties: Dict[str, Any] = {}
34
- __properties = ["attribution", "query", "warnings", "errors"]
35
-
36
- class Config:
37
- """Pydantic configuration"""
38
- allow_population_by_field_name = True
39
- validate_assignment = True
40
-
41
- def to_str(self) -> str:
42
- """Returns the string representation of the model using alias"""
43
- return pprint.pformat(self.dict(by_alias=True))
44
-
45
- def to_json(self) -> str:
46
- """Returns the JSON representation of the model using alias"""
47
- return json.dumps(self.to_dict())
48
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> PeliasResponseGeocoding:
51
- """Create an instance of PeliasResponseGeocoding from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self):
55
- """Returns the dictionary representation of the model using alias"""
56
- _dict = self.dict(by_alias=True,
57
- exclude={
58
- "additional_properties"
59
- },
60
- exclude_none=True)
61
- # puts key-value pairs in additional_properties in the top level
62
- if self.additional_properties is not None:
63
- for _key, _value in self.additional_properties.items():
64
- _dict[_key] = _value
65
-
66
- return _dict
67
-
68
- @classmethod
69
- def from_dict(cls, obj: dict) -> PeliasResponseGeocoding:
70
- """Create an instance of PeliasResponseGeocoding from a dict"""
71
- if obj is None:
72
- return None
73
-
74
- if not isinstance(obj, dict):
75
- return PeliasResponseGeocoding.parse_obj(obj)
76
-
77
- _obj = PeliasResponseGeocoding.parse_obj({
78
- "attribution": obj.get("attribution"),
79
- "query": obj.get("query"),
80
- "warnings": obj.get("warnings"),
81
- "errors": obj.get("errors")
82
- })
83
- # store additional fields in additional_properties
84
- for _key in obj.keys():
85
- if _key not in cls.__properties:
86
- _obj.additional_properties[_key] = obj.get(_key)
87
-
88
- return _obj
89
-
@@ -1,117 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Stadia Maps Geospatial APIs
5
-
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
7
-
8
- The version of the OpenAPI document: 5.0.6
9
- Contact: support@stadiamaps.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
-
22
- from typing import List
23
- from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist
24
- from stadiamaps.models.route_leg import RouteLeg
25
- from stadiamaps.models.route_summary import RouteSummary
26
- from stadiamaps.models.routing_response_waypoint import RoutingResponseWaypoint
27
- from stadiamaps.models.valhalla_languages import ValhallaLanguages
28
- from stadiamaps.models.valhalla_long_units import ValhallaLongUnits
29
-
30
- class RouteResponseTrip(BaseModel):
31
- """
32
- RouteResponseTrip
33
- """
34
- status: StrictInt = Field(..., description="The response status code")
35
- status_message: StrictStr = Field(..., description="The response status message")
36
- units: ValhallaLongUnits = Field(...)
37
- language: ValhallaLanguages = Field(...)
38
- locations: conlist(RoutingResponseWaypoint) = Field(...)
39
- legs: conlist(RouteLeg) = Field(...)
40
- summary: RouteSummary = Field(...)
41
- additional_properties: Dict[str, Any] = {}
42
- __properties = ["status", "status_message", "units", "language", "locations", "legs", "summary"]
43
-
44
- class Config:
45
- """Pydantic configuration"""
46
- allow_population_by_field_name = True
47
- validate_assignment = True
48
-
49
- def to_str(self) -> str:
50
- """Returns the string representation of the model using alias"""
51
- return pprint.pformat(self.dict(by_alias=True))
52
-
53
- def to_json(self) -> str:
54
- """Returns the JSON representation of the model using alias"""
55
- return json.dumps(self.to_dict())
56
-
57
- @classmethod
58
- def from_json(cls, json_str: str) -> RouteResponseTrip:
59
- """Create an instance of RouteResponseTrip from a JSON string"""
60
- return cls.from_dict(json.loads(json_str))
61
-
62
- def to_dict(self):
63
- """Returns the dictionary representation of the model using alias"""
64
- _dict = self.dict(by_alias=True,
65
- exclude={
66
- "additional_properties"
67
- },
68
- exclude_none=True)
69
- # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
70
- _items = []
71
- if self.locations:
72
- for _item in self.locations:
73
- if _item:
74
- _items.append(_item.to_dict())
75
- _dict['locations'] = _items
76
- # override the default output from pydantic by calling `to_dict()` of each item in legs (list)
77
- _items = []
78
- if self.legs:
79
- for _item in self.legs:
80
- if _item:
81
- _items.append(_item.to_dict())
82
- _dict['legs'] = _items
83
- # override the default output from pydantic by calling `to_dict()` of summary
84
- if self.summary:
85
- _dict['summary'] = self.summary.to_dict()
86
- # puts key-value pairs in additional_properties in the top level
87
- if self.additional_properties is not None:
88
- for _key, _value in self.additional_properties.items():
89
- _dict[_key] = _value
90
-
91
- return _dict
92
-
93
- @classmethod
94
- def from_dict(cls, obj: dict) -> RouteResponseTrip:
95
- """Create an instance of RouteResponseTrip from a dict"""
96
- if obj is None:
97
- return None
98
-
99
- if not isinstance(obj, dict):
100
- return RouteResponseTrip.parse_obj(obj)
101
-
102
- _obj = RouteResponseTrip.parse_obj({
103
- "status": obj.get("status"),
104
- "status_message": obj.get("status_message"),
105
- "units": obj.get("units"),
106
- "language": obj.get("language"),
107
- "locations": [RoutingResponseWaypoint.from_dict(_item) for _item in obj.get("locations")] if obj.get("locations") is not None else None,
108
- "legs": [RouteLeg.from_dict(_item) for _item in obj.get("legs")] if obj.get("legs") is not None else None,
109
- "summary": RouteSummary.from_dict(obj.get("summary")) if obj.get("summary") is not None else None
110
- })
111
- # store additional fields in additional_properties
112
- for _key in obj.keys():
113
- if _key not in cls.__properties:
114
- _obj.additional_properties[_key] = obj.get(_key)
115
-
116
- return _obj
117
-
@@ -1,96 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Stadia Maps Geospatial APIs
5
-
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
7
-
8
- The version of the OpenAPI document: 5.0.6
9
- Contact: support@stadiamaps.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
-
22
- from typing import List, Optional
23
- from pydantic import BaseModel, Field, StrictStr, conlist
24
- from stadiamaps.models.trace_attributes_base_response import TraceAttributesBaseResponse
25
- from stadiamaps.models.valhalla_long_units import ValhallaLongUnits
26
-
27
- class TraceAttributesResponseAllOf(BaseModel):
28
- """
29
- TraceAttributesResponseAllOf
30
- """
31
- id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
32
- units: Optional[ValhallaLongUnits] = None
33
- alternate_paths: Optional[conlist(TraceAttributesBaseResponse)] = Field(None, description="Alternate paths, if any, that were not classified as the best match.")
34
- additional_properties: Dict[str, Any] = {}
35
- __properties = ["id", "units", "alternate_paths"]
36
-
37
- class Config:
38
- """Pydantic configuration"""
39
- allow_population_by_field_name = True
40
- validate_assignment = True
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.dict(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- return json.dumps(self.to_dict())
49
-
50
- @classmethod
51
- def from_json(cls, json_str: str) -> TraceAttributesResponseAllOf:
52
- """Create an instance of TraceAttributesResponseAllOf from a JSON string"""
53
- return cls.from_dict(json.loads(json_str))
54
-
55
- def to_dict(self):
56
- """Returns the dictionary representation of the model using alias"""
57
- _dict = self.dict(by_alias=True,
58
- exclude={
59
- "additional_properties"
60
- },
61
- exclude_none=True)
62
- # override the default output from pydantic by calling `to_dict()` of each item in alternate_paths (list)
63
- _items = []
64
- if self.alternate_paths:
65
- for _item in self.alternate_paths:
66
- if _item:
67
- _items.append(_item.to_dict())
68
- _dict['alternate_paths'] = _items
69
- # puts key-value pairs in additional_properties in the top level
70
- if self.additional_properties is not None:
71
- for _key, _value in self.additional_properties.items():
72
- _dict[_key] = _value
73
-
74
- return _dict
75
-
76
- @classmethod
77
- def from_dict(cls, obj: dict) -> TraceAttributesResponseAllOf:
78
- """Create an instance of TraceAttributesResponseAllOf from a dict"""
79
- if obj is None:
80
- return None
81
-
82
- if not isinstance(obj, dict):
83
- return TraceAttributesResponseAllOf.parse_obj(obj)
84
-
85
- _obj = TraceAttributesResponseAllOf.parse_obj({
86
- "id": obj.get("id"),
87
- "units": obj.get("units"),
88
- "alternate_paths": [TraceAttributesBaseResponse.from_dict(_item) for _item in obj.get("alternate_paths")] if obj.get("alternate_paths") is not None else None
89
- })
90
- # store additional fields in additional_properties
91
- for _key in obj.keys():
92
- if _key not in cls.__properties:
93
- _obj.additional_properties[_key] = obj.get(_key)
94
-
95
- return _obj
96
-
@@ -1,79 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: stadiamaps
3
- Version: 4.0.0
4
- Summary: Stadia Maps Geospatial APIs
5
- Home-page: https://github.com/stadiamaps/stadiamaps-api-py
6
- Author: Stadia Maps Support
7
- Author-email: support@stadiamaps.com
8
- Keywords: OpenAPI,OpenAPI-Generator,Stadia Maps Geospatial APIs
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE.txt
11
- Requires-Dist: urllib3 <2.1.0,>=1.25.3
12
- Requires-Dist: python-dateutil
13
- Requires-Dist: pydantic >=2
14
- Requires-Dist: typing-extensions >=4.7.1
15
-
16
-
17
- # Stadia Maps Python API Client
18
-
19
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
20
-
21
- For more information about the API, please visit [https://docs.stadiamaps.com](https://docs.stadiamaps.com)
22
-
23
- ## Installation & Usage
24
- ### pip install
25
-
26
- ```shell
27
- pip install stadiamaps
28
- ```
29
-
30
- ### Setuptools
31
-
32
- Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33
-
34
- ```shell
35
- python setup.py install --user
36
- ```
37
- (or `sudo python setup.py install` to install the package for all users)
38
-
39
- ### Tests
40
-
41
- Execute `pytest` to run the tests. These are run automatically via CI.
42
-
43
- ## Getting Started
44
-
45
- Please follow the [installation procedure](#installation--usage) and then run the following:
46
-
47
- ```python
48
- import os
49
- import stadiamaps
50
- from stadiamaps.rest import ApiException
51
- from pprint import pprint
52
-
53
- # Defining the host is optional and defaults to https://api.stadiamaps.com
54
- # You can also use our EU endpoint to keep traffic within the EU like so:
55
- # configuration = stadiamaps.Configuration(host="https://api-eu.stadiamaps.com")
56
- # See configuration.py for a list of all supported configuration parameters.
57
- configuration = stadiamaps.Configuration()
58
-
59
- # Configure API key authorization. This example assumes it is injected via an environment
60
- # variable.
61
- configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
62
-
63
- # Enter a context with an instance of the API client
64
- with stadiamaps.ApiClient(configuration) as api_client:
65
- # Create an instance of the API class
66
- api_instance = stadiamaps.GeocodingApi(api_client)
67
- text = "Põhja pst 27a" # str | The place name (address, venue name, etc.) to search for.
68
-
69
- try:
70
- # Search and geocode quickly based on partial input.
71
- api_response = api_instance.autocomplete(text)
72
- print("The response of GeocodingApi->autocomplete:
73
- ")
74
- pprint(api_response)
75
- except ApiException as e:
76
- print("Exception when calling GeocodingApi->autocomplete: %s
77
- " % e)
78
- ```
79
-