stadiamaps 5.0.0__py3-none-any.whl → 6.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 +23 -5
- stadiamaps/api/geocoding_api.py +1388 -138
- stadiamaps/api/geospatial_api.py +1 -1
- stadiamaps/api/routing_api.py +1 -1
- stadiamaps/api_client.py +3 -3
- stadiamaps/configuration.py +5 -5
- stadiamaps/exceptions.py +18 -1
- stadiamaps/models/__init__.py +22 -4
- stadiamaps/models/access.py +1 -1
- stadiamaps/models/addendum_v2.py +143 -0
- stadiamaps/models/address_components_v2.py +134 -0
- stadiamaps/models/admin_region.py +1 -1
- stadiamaps/models/administrative.py +1 -1
- stadiamaps/models/annotation_filters.py +1 -1
- stadiamaps/models/auto_costing_options.py +1 -1
- stadiamaps/models/base_costing_options.py +1 -1
- stadiamaps/models/base_trace_request.py +1 -1
- stadiamaps/models/bicycle_costing_options.py +1 -1
- stadiamaps/models/bike_network.py +1 -1
- stadiamaps/models/bulk_request.py +1 -1
- stadiamaps/models/bulk_request_query.py +1 -1
- stadiamaps/models/bulk_search_response.py +1 -1
- stadiamaps/models/context.py +119 -0
- stadiamaps/models/contour.py +1 -1
- stadiamaps/models/coordinate.py +1 -1
- stadiamaps/models/costing_model.py +1 -1
- stadiamaps/models/costing_options.py +1 -1
- stadiamaps/models/directions_options.py +1 -1
- stadiamaps/models/distance_unit.py +1 -1
- stadiamaps/models/edge_sign.py +1 -1
- stadiamaps/models/edge_use.py +1 -1
- stadiamaps/models/end_node.py +1 -1
- stadiamaps/models/extended_directions_options.py +1 -1
- stadiamaps/models/feature_properties_v2.py +126 -0
- stadiamaps/models/feature_properties_v2_properties.py +184 -0
- stadiamaps/models/foursquare_addendum.py +113 -0
- stadiamaps/models/geo_attributes.py +1 -1
- stadiamaps/models/geo_json_geometry_base.py +1 -1
- stadiamaps/models/geo_json_point.py +1 -1
- stadiamaps/models/geocode_response.py +1 -1
- stadiamaps/models/geocode_response_envelope_properties_v2.py +125 -0
- stadiamaps/models/geocoding_geo_json_feature.py +1 -1
- stadiamaps/models/geocoding_geo_json_properties.py +8 -6
- stadiamaps/models/geocoding_geo_json_properties_addendum.py +1 -1
- stadiamaps/models/geocoding_geo_json_properties_addendum_osm.py +1 -1
- stadiamaps/models/geocoding_layer.py +1 -1
- stadiamaps/models/geocoding_meta.py +108 -0
- stadiamaps/models/geocoding_object.py +1 -1
- stadiamaps/models/geocoding_source.py +1 -1
- stadiamaps/models/geonames_addendum.py +101 -0
- stadiamaps/models/height_request.py +1 -1
- stadiamaps/models/height_response.py +1 -1
- stadiamaps/models/highway_classification.py +1 -1
- stadiamaps/models/intersecting_edge.py +1 -1
- stadiamaps/models/isochrone_costing_model.py +1 -1
- stadiamaps/models/isochrone_feature.py +1 -1
- stadiamaps/models/isochrone_properties.py +1 -1
- stadiamaps/models/isochrone_request.py +1 -1
- stadiamaps/models/isochrone_response.py +1 -1
- stadiamaps/models/layer_id.py +57 -0
- stadiamaps/models/locate_detailed_edge.py +1 -1
- stadiamaps/models/locate_edge.py +1 -1
- stadiamaps/models/locate_edge_info.py +1 -1
- stadiamaps/models/locate_node.py +1 -1
- stadiamaps/models/locate_object.py +1 -1
- stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
- stadiamaps/models/maneuver_sign.py +1 -1
- stadiamaps/models/maneuver_sign_element.py +1 -1
- stadiamaps/models/map_match_costing_model.py +1 -1
- stadiamaps/models/map_match_request.py +1 -1
- stadiamaps/models/map_match_route_response.py +1 -1
- stadiamaps/models/map_match_trace_options.py +1 -1
- stadiamaps/models/map_match_waypoint.py +3 -3
- stadiamaps/models/match_type.py +39 -0
- stadiamaps/models/matched_point.py +1 -1
- stadiamaps/models/matrix_costing_model.py +1 -1
- stadiamaps/models/matrix_distance.py +1 -1
- stadiamaps/models/matrix_request.py +1 -1
- stadiamaps/models/matrix_response.py +1 -1
- stadiamaps/models/matrix_waypoint.py +1 -1
- stadiamaps/models/motor_scooter_costing_options.py +1 -1
- stadiamaps/models/motorcycle_costing_options.py +1 -1
- stadiamaps/models/nearest_roads_request.py +1 -1
- stadiamaps/models/node_id.py +1 -1
- stadiamaps/models/node_type.py +1 -1
- stadiamaps/models/open_street_map_addendum.py +169 -0
- stadiamaps/models/optimized_route_request.py +1 -1
- stadiamaps/models/osrm_admin.py +1 -1
- stadiamaps/models/osrm_annotation.py +1 -1
- stadiamaps/models/osrm_banner_component.py +1 -1
- stadiamaps/models/osrm_banner_content.py +1 -1
- stadiamaps/models/osrm_banner_instruction.py +1 -1
- stadiamaps/models/osrm_base_api_response.py +1 -1
- stadiamaps/models/osrm_guidance_modifier.py +1 -1
- stadiamaps/models/osrm_intersection.py +1 -1
- stadiamaps/models/osrm_lane.py +1 -1
- stadiamaps/models/osrm_route.py +1 -1
- stadiamaps/models/osrm_route_leg.py +1 -1
- stadiamaps/models/osrm_route_response.py +1 -1
- stadiamaps/models/osrm_route_step.py +1 -1
- stadiamaps/models/osrm_speed_limit.py +1 -1
- stadiamaps/models/osrm_step_maneuver.py +1 -1
- stadiamaps/models/osrm_via_waypoint.py +1 -1
- stadiamaps/models/osrm_voice_instruction.py +1 -1
- stadiamaps/models/osrm_waypoint.py +1 -1
- stadiamaps/models/pedestrian_costing_options.py +8 -5
- stadiamaps/models/pedestrian_type.py +39 -0
- stadiamaps/models/point.py +104 -0
- stadiamaps/models/precision.py +38 -0
- stadiamaps/models/properties_v2.py +184 -0
- stadiamaps/models/restrictions.py +11 -11
- stadiamaps/models/road_class.py +1 -1
- stadiamaps/models/route200_response.py +1 -1
- stadiamaps/models/route_leg.py +1 -1
- stadiamaps/models/route_maneuver.py +1 -1
- stadiamaps/models/route_request.py +1 -1
- stadiamaps/models/route_response.py +1 -1
- stadiamaps/models/route_response_alternates_inner.py +1 -1
- stadiamaps/models/route_summary.py +1 -1
- stadiamaps/models/route_trip.py +1 -1
- stadiamaps/models/routing_languages.py +1 -1
- stadiamaps/models/routing_long_units.py +1 -1
- stadiamaps/models/routing_response_waypoint.py +3 -3
- stadiamaps/models/routing_waypoint.py +3 -3
- stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
- stadiamaps/models/search_query.py +2 -2
- stadiamaps/models/search_structured_query.py +3 -3
- stadiamaps/models/simple_routing_waypoint.py +3 -3
- stadiamaps/models/source_attribution.py +110 -0
- stadiamaps/models/source_id.py +41 -0
- stadiamaps/models/speeds.py +1 -1
- stadiamaps/models/trace_attribute_filter_options.py +1 -1
- stadiamaps/models/trace_attribute_key.py +1 -1
- stadiamaps/models/trace_attributes_base_response.py +1 -1
- stadiamaps/models/trace_attributes_request.py +1 -1
- stadiamaps/models/trace_attributes_response.py +1 -6
- stadiamaps/models/trace_edge.py +2 -7
- stadiamaps/models/travel_mode.py +1 -1
- stadiamaps/models/traversability.py +1 -1
- stadiamaps/models/truck_costing_options.py +1 -1
- stadiamaps/models/tz_response.py +1 -1
- stadiamaps/models/warning.py +1 -1
- stadiamaps/models/whos_on_first_concordances.py +246 -0
- stadiamaps/models/wof_context.py +210 -0
- stadiamaps/models/wof_context_component.py +110 -0
- stadiamaps/rest.py +1 -1
- stadiamaps-6.1.0.dist-info/METADATA +117 -0
- stadiamaps-6.1.0.dist-info/RECORD +183 -0
- {stadiamaps-5.0.0.dist-info → stadiamaps-6.1.0.dist-info}/WHEEL +1 -1
- {stadiamaps-5.0.0.dist-info → stadiamaps-6.1.0.dist-info}/top_level.txt +1 -0
- test/integration/__init__.py +0 -0
- test/integration/test_eu_endpoint.py +21 -0
- test/integration/test_gecoding.py +136 -0
- test/integration/test_geospatial.py +43 -0
- test/integration/test_routing.py +282 -0
- stadiamaps-5.0.0.dist-info/METADATA +0 -87
- stadiamaps-5.0.0.dist-info/RECORD +0 -157
- {stadiamaps-5.0.0.dist-info → stadiamaps-6.1.0.dist-info/licenses}/LICENSE.txt +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
import os
|
2
|
+
import unittest
|
3
|
+
|
4
|
+
import stadiamaps
|
5
|
+
|
6
|
+
|
7
|
+
class TestEUEndpoint(unittest.TestCase):
|
8
|
+
def setUp(self):
|
9
|
+
self.configuration = stadiamaps.Configuration(host="https://api-eu.stadiamaps.com")
|
10
|
+
self.configuration.api_key["ApiKeyAuth"] = os.environ["STADIA_API_KEY"]
|
11
|
+
|
12
|
+
def tearDown(self):
|
13
|
+
pass
|
14
|
+
|
15
|
+
def testAutocomplete(self):
|
16
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
17
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
18
|
+
|
19
|
+
res = api_instance.autocomplete("Põhja pst 27")
|
20
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
21
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import os
|
2
|
+
import unittest
|
3
|
+
|
4
|
+
import stadiamaps
|
5
|
+
|
6
|
+
address = "Põhja pst 27"
|
7
|
+
|
8
|
+
|
9
|
+
class TestGeocoding(unittest.TestCase):
|
10
|
+
def setUp(self):
|
11
|
+
self.configuration = stadiamaps.Configuration()
|
12
|
+
self.configuration.api_key["ApiKeyAuth"] = os.environ["STADIA_API_KEY"]
|
13
|
+
|
14
|
+
def tearDown(self):
|
15
|
+
pass
|
16
|
+
|
17
|
+
def testAutocompleteV1(self):
|
18
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
19
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
20
|
+
|
21
|
+
res = api_instance.autocomplete(text=address)
|
22
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
23
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
24
|
+
|
25
|
+
def testAutocompleteV2(self):
|
26
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
27
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
28
|
+
|
29
|
+
res = api_instance.autocomplete_v2(text=address)
|
30
|
+
self.assertEqual(None, res.features[0].properties.context)
|
31
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
32
|
+
|
33
|
+
def testSearch(self):
|
34
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
35
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
36
|
+
|
37
|
+
res = api_instance.search(address)
|
38
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
39
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
40
|
+
|
41
|
+
def testStructuredSearch(self):
|
42
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
43
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
44
|
+
|
45
|
+
res = api_instance.search_structured(address=address, country="Estonia")
|
46
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
47
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
48
|
+
|
49
|
+
def testReverse(self):
|
50
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
51
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
52
|
+
|
53
|
+
res = api_instance.reverse(59.444351, 24.750645)
|
54
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
55
|
+
|
56
|
+
def testReverseV2(self):
|
57
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
58
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
59
|
+
|
60
|
+
res = api_instance.reverse_v2(59.444351, 24.750645)
|
61
|
+
self.assertEqual("EST", res.features[0].properties.context.iso_3166_a3)
|
62
|
+
|
63
|
+
def testReverseWithLayerFilter(self):
|
64
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
65
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
66
|
+
|
67
|
+
res = api_instance.reverse(59.444351, 24.750645,
|
68
|
+
layers=[stadiamaps.GeocodingLayer.ADDRESS, stadiamaps.GeocodingLayer.OCEAN])
|
69
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
70
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
71
|
+
|
72
|
+
def testReverseWithLayerFilterV2(self):
|
73
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
74
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
75
|
+
|
76
|
+
res = api_instance.reverse_v2(59.444351, 24.750645,
|
77
|
+
layers=[stadiamaps.LayerId.ADDRESS, stadiamaps.LayerId.OCEAN])
|
78
|
+
self.assertEqual("EST", res.features[0].properties.context.iso_3166_a3)
|
79
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
80
|
+
|
81
|
+
def testReverseUncommonLayer(self):
|
82
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
83
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
84
|
+
|
85
|
+
# Middle of the Gulf of Oman
|
86
|
+
res = api_instance.reverse(24.750645, 59.444351)
|
87
|
+
self.assertEqual("marinearea", res.features[0].properties.layer)
|
88
|
+
|
89
|
+
def testReverseUncommonLayerV2(self):
|
90
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
91
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
92
|
+
|
93
|
+
# Middle of the Gulf of Oman
|
94
|
+
res = api_instance.reverse_v2(24.750645, 59.444351)
|
95
|
+
self.assertEqual("marinearea", res.features[0].properties.layer)
|
96
|
+
|
97
|
+
def testPlaceV1(self):
|
98
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
99
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
100
|
+
|
101
|
+
res = api_instance.place_details(["openstreetmap:address:way/109867749"])
|
102
|
+
self.assertEqual(1, len(res.features))
|
103
|
+
self.assertEqual("Estonia", res.features[0].properties.country)
|
104
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
105
|
+
|
106
|
+
def testPlaceV2(self):
|
107
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
108
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
109
|
+
|
110
|
+
res = api_instance.place_details_v2(["openstreetmap:address:way/109867749"])
|
111
|
+
self.assertEqual(1, len(res.features))
|
112
|
+
self.assertEqual("Estonia", res.features[0].properties.context.whosonfirst.country.name)
|
113
|
+
self.assertEqual("EST", res.features[0].properties.context.iso_3166_a3)
|
114
|
+
self.assertEqual("address", res.features[0].properties.layer)
|
115
|
+
|
116
|
+
def testBulk(self):
|
117
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
118
|
+
api_instance = stadiamaps.GeocodingApi(api_client)
|
119
|
+
|
120
|
+
res = api_instance.search_bulk([
|
121
|
+
stadiamaps.BulkRequest(endpoint="/v1/search",
|
122
|
+
query=stadiamaps.BulkRequestQuery(stadiamaps.SearchQuery(text=address))),
|
123
|
+
stadiamaps.BulkRequest(endpoint="/v1/search/structured",
|
124
|
+
query=stadiamaps.BulkRequestQuery(stadiamaps.SearchStructuredQuery(
|
125
|
+
address=address,
|
126
|
+
country="EE",
|
127
|
+
layers=[
|
128
|
+
stadiamaps.GeocodingLayer.COARSE,
|
129
|
+
stadiamaps.GeocodingLayer.ADDRESS]))),
|
130
|
+
])
|
131
|
+
|
132
|
+
self.assertEqual(2, len(res))
|
133
|
+
for rec in res:
|
134
|
+
self.assertEqual(200, rec.status)
|
135
|
+
self.assertEqual("Estonia", rec.response.features[0].properties.country)
|
136
|
+
self.assertEqual("address", rec.response.features[0].properties.layer)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import os
|
2
|
+
import unittest
|
3
|
+
|
4
|
+
import stadiamaps
|
5
|
+
|
6
|
+
|
7
|
+
class TestGeospatial(unittest.TestCase):
|
8
|
+
def setUp(self):
|
9
|
+
self.configuration = stadiamaps.Configuration()
|
10
|
+
self.configuration.api_key["ApiKeyAuth"] = os.environ["STADIA_API_KEY"]
|
11
|
+
|
12
|
+
def tearDown(self):
|
13
|
+
pass
|
14
|
+
|
15
|
+
def testTZLookup(self):
|
16
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
17
|
+
api_instance = stadiamaps.GeospatialApi(api_client)
|
18
|
+
|
19
|
+
res = api_instance.tz_lookup(37.56, 126.99)
|
20
|
+
self.assertEqual("Asia/Seoul", res.tz_id)
|
21
|
+
|
22
|
+
def testElevation(self):
|
23
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
24
|
+
api_instance = stadiamaps.GeospatialApi(api_client)
|
25
|
+
|
26
|
+
req = stadiamaps.HeightRequest(id="Seoul", shape=[stadiamaps.Coordinate(lat=37.56, lon=126.99)], range=False)
|
27
|
+
res = api_instance.elevation(req)
|
28
|
+
self.assertEqual(req.id, res.id)
|
29
|
+
self.assertGreaterEqual(len(res.height), 1)
|
30
|
+
self.assertGreaterEqual(res.height[0], 1)
|
31
|
+
self.assertEqual(res.shape, req.shape)
|
32
|
+
|
33
|
+
def testElevationRange(self):
|
34
|
+
with stadiamaps.ApiClient(self.configuration) as api_client:
|
35
|
+
api_instance = stadiamaps.GeospatialApi(api_client)
|
36
|
+
|
37
|
+
req = stadiamaps.HeightRequest(id="Seoul", shape=[stadiamaps.Coordinate(lat=37.56, lon=126.99)], range=True)
|
38
|
+
res = api_instance.elevation(req)
|
39
|
+
self.assertEqual(req.id, res.id)
|
40
|
+
self.assertGreaterEqual(len(res.range_height), 1)
|
41
|
+
self.assertEqual(res.range_height[0][0], 0) # This is always zero for the first element
|
42
|
+
self.assertGreaterEqual(res.range_height[0][1], 1)
|
43
|
+
self.assertEqual(res.shape, req.shape)
|
@@ -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@r@bGv@tF`AnFdA|ErA~EzAxE~BzF|I`SjAxC|@nCl@zB`@lBXtBPhBJ`BDfB@dDCjDGxDqIv}BUrIKpFE|C@|CFhD`@nM`@lJPnDJhAdkA|fMob@i`@gAZfEhgAT|FpDvEnKISjr@pHfe@dHjCvM{F{Lak@q@mZq[bbC~OnAvRvWcHrVzK`GzH}TxGdDoDrKyHlVwG`TvGaTfI|EnBxBZvBGj]AnDAlC\\lB~K~ZtoAlEuExOy@bFi@xHFxF^fEl@rDfBxGbC~GjEdKjQbm@oG|YvBpFrMbV~GlMlGtJtFlHlEjFnGtJzDjGzDvHjBtFrD`IzB`DzD~ClDjBzDjCzChAjD~@?vF^tHx@vGpA~DbB`CpBhArCSrDk@dEkAxB_AbC_BpBkB`@K`B]pFp@fDx@tDh@`BHrCJ~CKd@S`Bk@fAcA`AtP`UxCcAfUsChq@wBSkBSiB[}BiAwMbOvMcO|BhAhBZjBRvBRwC`o@g@vJjBeC~@c@tAz@xF`NnX~p@zAlDtAvA|Bv@xBQ??fo@vsBJhDpc@`aDhBrHzCtHzHtP}Vz_@iFjIiFpIoEbIaJnPzf@d_BuAlQiA~^qd@|dMcCru@G|Cq@|^]z_@LnV^x]RtHd@xP`Bdb@pCbStApIpAjFdCnHlCtFtBlDxDxEdBfBnCnC`~B`yMhA`A|bHvr`@~CxVbF_A~a@yJbS}EvDXdM|AvJ{F{gAjtDgCddC|f@jyDbEtPxuG|scBsDxMahGvkYlXhT`DvCfChC|BjCfBlC|C`GvDdI~_@jbAhJ`Vt|AltGoH~FcTdLqDlA}Af@zhAgl@jEzSnCnNnCjOfBnL~C`XfA~J|@`Kj@hJXtHzAtm@v@xSZrEh@pDdApDfDxFaDxDiA`DG~FpBz^v@tL~@hIt@jDhAdDpYxf@feAbhB{]va@iPuXaBeD`BdDhPtX{JjM~Jz]|@TvPaOjJ~OvNtV|N|Vla@xr@zWjd@fAjBkGlHuUnXqB`CaFgIoK_QmF`HuJcPiFfHo@~BUtBFtA`@zAdA~AfQ|Vb@p@|@rJcCrCxQ|YhmNn`hAk@zECnEbV`x@dBnBlGdAlCX|m@o[tBkDdAoFf@mCdMwGvE~NzGhLzDxE}FtIcC|Bcu@xq@eBzCe@hC~x@t~ElhZpalAln@mSAjKp@pJyKpBqSxHh|KdwX~eMnjv@B_BV_BXeAt@y@fLaChRwBdO]tKXpN~Cz[`N_A`CcArIjC|qAUjHmAnG}BzEyDxDyeAli@hoDxhMpHxEaBdMh@jN~I``@jLpk@v@~D~e@nqE|@`ChBlCRzAP`B|CvHl\\yNlT{HCnGLvBxFn[fBzJ~A|IzAnGpBrGrCvFnOtVfEdIhEvJhBpFiLpH{d@fZiAdE\\hF`tDtzJCFzt@lg@mCpIiDtKhDuKlCqIrD_MbNid@sY}Q{LiJkIqHHaI]wEX{H|AwG`HaNnBzBtLjK`MxIbNrI`e@xYxKjJpIrI~HrKzG`NzErKtDdL~C`OdCtOhFvj@mLdC[F|SxzB~LyBzAxPhChYl@`E`AbExAdDjBxC|BvBtBfBlCpAdDz@nDl@|D^pGf@lSzAxIn@kAxScA|QTvAf@~AdNtSrg@taCfAxGyHfF{KdHiAp@vc@rrBw@hOk@|K~bBh|W~CnHfF`GdMnGpH`AlIm@nh@kL~gAfrOCbMbAbMD`@~@pRMhLNrRaBbB?fLvG`@zC\\|I~@SrOI`FzAfGoKpJqKpJ}@pLjPf\\rFT`H}AhBjA|HXClFyAdHuD~Jm\\oDsUkAwM]eMxrBqLvcCoC|{@e@jk@rBrjD`Ar|CJz{C[l~B[|nA_ExnAgGds@wGxd@}G~f@mDvSkDpTsArIuNd~@cGxi@sHxcAy@bWcAfl@y@|m@aBhz@sAbp@[hNIbDqCncBuDn|CaA~pAEvJn@bnApAtaA`@dZfErr@xDrh@`Du@|EiEp@cEfBcF^|EsAzIaFbFcFnBdEbi@h@~GpFf@n@hA^rCnBb[qALkHj@NdKFhGkAvc@e@fFuB`LiAjG_Phw@q@fDwIrb@Ev@dCdJlBdCnC~@dFDwB~AbCdGfE`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,87 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: stadiamaps
|
3
|
-
Version: 5.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<3.0.0,>=1.25.3
|
12
|
-
Requires-Dist: python-dateutil>=2.8.2
|
13
|
-
Requires-Dist: pydantic>=2
|
14
|
-
Requires-Dist: typing-extensions>=4.7.1
|
15
|
-
Dynamic: author
|
16
|
-
Dynamic: author-email
|
17
|
-
Dynamic: description
|
18
|
-
Dynamic: description-content-type
|
19
|
-
Dynamic: home-page
|
20
|
-
Dynamic: keywords
|
21
|
-
Dynamic: requires-dist
|
22
|
-
Dynamic: summary
|
23
|
-
|
24
|
-
|
25
|
-
# Stadia Maps Python API Client
|
26
|
-
|
27
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
28
|
-
|
29
|
-
For more information about the API, please visit [https://docs.stadiamaps.com](https://docs.stadiamaps.com)
|
30
|
-
|
31
|
-
## Installation & Usage
|
32
|
-
### pip install
|
33
|
-
|
34
|
-
```shell
|
35
|
-
pip install stadiamaps
|
36
|
-
```
|
37
|
-
|
38
|
-
### Setuptools
|
39
|
-
|
40
|
-
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
41
|
-
|
42
|
-
```shell
|
43
|
-
python setup.py install --user
|
44
|
-
```
|
45
|
-
(or `sudo python setup.py install` to install the package for all users)
|
46
|
-
|
47
|
-
### Tests
|
48
|
-
|
49
|
-
Execute `pytest` to run the tests. These are run automatically via CI.
|
50
|
-
|
51
|
-
## Getting Started
|
52
|
-
|
53
|
-
Please follow the [installation procedure](#installation--usage) and then run the following:
|
54
|
-
|
55
|
-
```python
|
56
|
-
import os
|
57
|
-
import stadiamaps
|
58
|
-
from stadiamaps.rest import ApiException
|
59
|
-
from pprint import pprint
|
60
|
-
|
61
|
-
# Defining the host is optional and defaults to https://api.stadiamaps.com
|
62
|
-
# You can also use our EU endpoint to keep traffic within the EU like so:
|
63
|
-
# configuration = stadiamaps.Configuration(host="https://api-eu.stadiamaps.com")
|
64
|
-
# See configuration.py for a list of all supported configuration parameters.
|
65
|
-
configuration = stadiamaps.Configuration()
|
66
|
-
|
67
|
-
# Configure API key authorization. This example assumes it is injected via an environment
|
68
|
-
# variable.
|
69
|
-
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
|
70
|
-
|
71
|
-
# Enter a context with an instance of the API client
|
72
|
-
with stadiamaps.ApiClient(configuration) as api_client:
|
73
|
-
# Create an instance of the API class
|
74
|
-
api_instance = stadiamaps.GeocodingApi(api_client)
|
75
|
-
text = "Põhja pst 27a" # str | The place name (address, venue name, etc.) to search for.
|
76
|
-
|
77
|
-
try:
|
78
|
-
# Search and geocode quickly based on partial input.
|
79
|
-
api_response = api_instance.autocomplete(text)
|
80
|
-
print("The response of GeocodingApi->autocomplete:
|
81
|
-
")
|
82
|
-
pprint(api_response)
|
83
|
-
except ApiException as e:
|
84
|
-
print("Exception when calling GeocodingApi->autocomplete: %s
|
85
|
-
" % e)
|
86
|
-
```
|
87
|
-
|