Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit 4f97aee

Browse files
authored
Fix encoding of coordinates and map ids (#261)
Resolves #259
1 parent 15989e7 commit 4f97aee

File tree

4 files changed

+34
-27
lines changed

4 files changed

+34
-27
lines changed

CHANGES

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changes
22
=======
33

4+
0.17.1 (2018-09-26)
5+
-------------------
6+
7+
Bug fixes:
8+
9+
- Fix for the encoding of Tilequery coordinates (#259).
10+
411
0.17.0 (TBD)
512
------------
613

mapbox/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mapbox
2-
__version__ = "0.17.0"
2+
__version__ = "0.17.1"
33

44
from .services.datasets import Datasets
55
from .services.directions import Directions

mapbox/services/tilequery.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ def tilequery(
163163
# Create dict to assist in building URI resource path.
164164

165165
path_values = dict(
166-
map_id=map_id, api_name=self.api_name, coordinates="{},{}".format(lon, lat)
166+
api_name=self.api_name, lon=lon, lat=lat
167167
)
168168

169169
# Build URI resource path.
170170

171-
path_part = "/{map_id}/{api_name}/{coordinates}.json"
171+
path_part = "/" + map_id + "/{api_name}/{lon},{lat}.json"
172172
uri = URITemplate(self.base_uri + path_part).expand(**path_values)
173173

174174
# Build URI query_parameters.

tests/test_tilequery.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_tilequery_one_mapid():
9797
+ "/v4"
9898
+ "/mapbox.mapbox-streets-v10"
9999
+ "/tilequery"
100-
+ "/0.0%2C1.1.json"
100+
+ "/0.0,1.1.json"
101101
+ "?access_token=pk.test",
102102
match_querystring=True,
103103
body='{"key": "value"}',
@@ -117,9 +117,9 @@ def test_tilequery_two_mapids():
117117
method=GET,
118118
url="https://api.mapbox.com"
119119
+ "/v4"
120-
+ "/mapbox.mapbox-streets-v9%2Cmapbox.mapbox-streets-v10"
120+
+ "/mapbox.mapbox-streets-v9,mapbox.mapbox-streets-v10"
121121
+ "/tilequery"
122-
+ "/0.0%2C1.1.json"
122+
+ "/0.0,1.1.json"
123123
+ "?access_token=pk.test",
124124
match_querystring=True,
125125
body='{"key": "value"}',
@@ -143,7 +143,7 @@ def test_tilequery_with_radius():
143143
+ "/v4"
144144
+ "/mapbox.mapbox-streets-v10"
145145
+ "/tilequery"
146-
+ "/0.0%2C1.1.json"
146+
+ "/0.0,1.1.json"
147147
+ "?access_token=pk.test"
148148
+ "&radius=25",
149149
match_querystring=True,
@@ -168,7 +168,7 @@ def test_tilequery_with_limit():
168168
+ "/v4"
169169
+ "/mapbox.mapbox-streets-v10"
170170
+ "/tilequery"
171-
+ "/0.0%2C1.1.json"
171+
+ "/0.0,1.1.json"
172172
+ "?access_token=pk.test"
173173
+ "&limit=25",
174174
match_querystring=True,
@@ -193,7 +193,7 @@ def test_tilequery_with_dedupe():
193193
+ "/v4"
194194
+ "/mapbox.mapbox-streets-v10"
195195
+ "/tilequery"
196-
+ "/0.0%2C1.1.json"
196+
+ "/0.0,1.1.json"
197197
+ "?access_token=pk.test"
198198
+ "&dedupe=true",
199199
match_querystring=True,
@@ -218,7 +218,7 @@ def test_tilequery_with_geometry():
218218
+ "/v4"
219219
+ "/mapbox.mapbox-streets-v10"
220220
+ "/tilequery"
221-
+ "/0.0%2C1.1.json"
221+
+ "/0.0,1.1.json"
222222
+ "?access_token=pk.test"
223223
+ "&geometry=linestring",
224224
match_querystring=True,
@@ -243,9 +243,9 @@ def test_tilequery_with_layers():
243243
+ "/v4"
244244
+ "/mapbox.mapbox-streets-v10"
245245
+ "/tilequery"
246-
+ "/0.0%2C1.1.json"
246+
+ "/0.0,1.1.json"
247247
+ "?access_token=pk.test"
248-
+ "&layers=layer0%2Clayer1%2Clayer2",
248+
+ "&layers=layer0,layer1%2Clayer2",
249249
match_querystring=True,
250250
body='{"key": "value"}',
251251
status=200,
@@ -271,7 +271,7 @@ def test_tilequery_with_radius_and_limit():
271271
+ "/v4"
272272
+ "/mapbox.mapbox-streets-v10"
273273
+ "/tilequery"
274-
+ "/0.0%2C1.1.json"
274+
+ "/0.0,1.1.json"
275275
+ "?access_token=pk.test"
276276
+ "&radius=25"
277277
+ "&limit=25",
@@ -297,7 +297,7 @@ def test_tilequery_with_radius_and_dedupe():
297297
+ "/v4"
298298
+ "/mapbox.mapbox-streets-v10"
299299
+ "/tilequery"
300-
+ "/0.0%2C1.1.json"
300+
+ "/0.0,1.1.json"
301301
+ "?access_token=pk.test"
302302
+ "&radius=25"
303303
+ "&dedupe=true",
@@ -323,7 +323,7 @@ def test_tilequery_with_radius_and_geometry():
323323
+ "/v4"
324324
+ "/mapbox.mapbox-streets-v10"
325325
+ "/tilequery"
326-
+ "/0.0%2C1.1.json"
326+
+ "/0.0,1.1.json"
327327
+ "?access_token=pk.test"
328328
+ "&radius=25"
329329
+ "&geometry=linestring",
@@ -349,10 +349,10 @@ def test_tilequery_with_radius_and_layers():
349349
+ "/v4"
350350
+ "/mapbox.mapbox-streets-v10"
351351
+ "/tilequery"
352-
+ "/0.0%2C1.1.json"
352+
+ "/0.0,1.1.json"
353353
+ "?access_token=pk.test"
354354
+ "&radius=25"
355-
+ "&layers=layer0%2Clayer1%2Clayer2",
355+
+ "&layers=layer0,layer1%2Clayer2",
356356
match_querystring=True,
357357
body='{"key": "value"}',
358358
status=200,
@@ -379,7 +379,7 @@ def test_tilequery_with_radius_limit_and_dedupe():
379379
+ "/v4"
380380
+ "/mapbox.mapbox-streets-v10"
381381
+ "/tilequery"
382-
+ "/0.0%2C1.1.json"
382+
+ "/0.0,1.1.json"
383383
+ "?access_token=pk.test"
384384
+ "&radius=25"
385385
+ "&limit=25"
@@ -406,7 +406,7 @@ def test_tilequery_with_radius_limit_and_geometry():
406406
+ "/v4"
407407
+ "/mapbox.mapbox-streets-v10"
408408
+ "/tilequery"
409-
+ "/0.0%2C1.1.json"
409+
+ "/0.0,1.1.json"
410410
+ "?access_token=pk.test"
411411
+ "&radius=25"
412412
+ "&limit=25"
@@ -438,11 +438,11 @@ def test_tilequery_with_radius_limit_and_layers():
438438
+ "/v4"
439439
+ "/mapbox.mapbox-streets-v10"
440440
+ "/tilequery"
441-
+ "/0.0%2C1.1.json"
441+
+ "/0.0,1.1.json"
442442
+ "?access_token=pk.test"
443443
+ "&radius=25"
444444
+ "&limit=25"
445-
+ "&layers=layer0%2Clayer1%2Clayer2",
445+
+ "&layers=layer0,layer1%2Clayer2",
446446
match_querystring=True,
447447
body='{"key": "value"}',
448448
status=200,
@@ -470,7 +470,7 @@ def test_tilequery_with_radius_limit_dedupe_and_geometry():
470470
+ "/v4"
471471
+ "/mapbox.mapbox-streets-v10"
472472
+ "/tilequery"
473-
+ "/0.0%2C1.1.json"
473+
+ "/0.0,1.1.json"
474474
+ "?access_token=pk.test"
475475
+ "&radius=25"
476476
+ "&limit=25"
@@ -504,12 +504,12 @@ def test_tilequery_with_radius_limit_dedupe_and_layers():
504504
+ "/v4"
505505
+ "/mapbox.mapbox-streets-v10"
506506
+ "/tilequery"
507-
+ "/0.0%2C1.1.json"
507+
+ "/0.0,1.1.json"
508508
+ "?access_token=pk.test"
509509
+ "&radius=25"
510510
+ "&limit=25"
511511
+ "&dedupe=true"
512-
+ "&layers=layer0%2Clayer1%2Clayer2",
512+
+ "&layers=layer0,layer1%2Clayer2",
513513
match_querystring=True,
514514
body='{"key": "value"}',
515515
status=200,
@@ -538,13 +538,13 @@ def test_tilequery_with_radius_limit_dedupe_geometry_and_layers():
538538
+ "/v4"
539539
+ "/mapbox.mapbox-streets-v10"
540540
+ "/tilequery"
541-
+ "/0.0%2C1.1.json"
541+
+ "/0.0,1.1.json"
542542
+ "?access_token=pk.test"
543543
+ "&radius=25"
544544
+ "&limit=25"
545545
+ "&dedupe=true"
546546
+ "&geometry=linestring"
547-
+ "&layers=layer0%2Clayer1%2Clayer2",
547+
+ "&layers=layer0,layer1%2Clayer2",
548548
match_querystring=True,
549549
body='{"key": "value"}',
550550
status=200,
@@ -574,7 +574,7 @@ def test_tilequery_geojson_method():
574574
+ "/v4"
575575
+ "/mapbox.mapbox-streets-v10"
576576
+ "/tilequery"
577-
+ "/0.0%2C1.1.json"
577+
+ "/0.0,1.1.json"
578578
+ "?access_token=pk.test",
579579
match_querystring=True,
580580
body='{"key": "value"}',

0 commit comments

Comments
 (0)