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

Fix encoding of coordinates and map ids #261

Merged
merged 1 commit into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changes
=======

0.17.1 (2018-09-26)
-------------------

Bug fixes:

- Fix for the encoding of Tilequery coordinates (#259).

0.17.0 (TBD)
------------

Expand Down
2 changes: 1 addition & 1 deletion mapbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mapbox
__version__ = "0.17.0"
__version__ = "0.17.1"

from .services.datasets import Datasets
from .services.directions import Directions
Expand Down
4 changes: 2 additions & 2 deletions mapbox/services/tilequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ def tilequery(
# Create dict to assist in building URI resource path.

path_values = dict(
map_id=map_id, api_name=self.api_name, coordinates="{},{}".format(lon, lat)
api_name=self.api_name, lon=lon, lat=lat
)

# Build URI resource path.

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

# Build URI query_parameters.
Expand Down
48 changes: 24 additions & 24 deletions tests/test_tilequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_tilequery_one_mapid():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test",
match_querystring=True,
body='{"key": "value"}',
Expand All @@ -117,9 +117,9 @@ def test_tilequery_two_mapids():
method=GET,
url="https://api.mapbox.com"
+ "/v4"
+ "/mapbox.mapbox-streets-v9%2Cmapbox.mapbox-streets-v10"
+ "/mapbox.mapbox-streets-v9,mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test",
match_querystring=True,
body='{"key": "value"}',
Expand All @@ -143,7 +143,7 @@ def test_tilequery_with_radius():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25",
match_querystring=True,
Expand All @@ -168,7 +168,7 @@ def test_tilequery_with_limit():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&limit=25",
match_querystring=True,
Expand All @@ -193,7 +193,7 @@ def test_tilequery_with_dedupe():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&dedupe=true",
match_querystring=True,
Expand All @@ -218,7 +218,7 @@ def test_tilequery_with_geometry():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&geometry=linestring",
match_querystring=True,
Expand All @@ -243,9 +243,9 @@ def test_tilequery_with_layers():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&layers=layer0%2Clayer1%2Clayer2",
+ "&layers=layer0,layer1%2Clayer2",
match_querystring=True,
body='{"key": "value"}',
status=200,
Expand All @@ -271,7 +271,7 @@ def test_tilequery_with_radius_and_limit():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25",
Expand All @@ -297,7 +297,7 @@ def test_tilequery_with_radius_and_dedupe():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&dedupe=true",
Expand All @@ -323,7 +323,7 @@ def test_tilequery_with_radius_and_geometry():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&geometry=linestring",
Expand All @@ -349,10 +349,10 @@ def test_tilequery_with_radius_and_layers():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&layers=layer0%2Clayer1%2Clayer2",
+ "&layers=layer0,layer1%2Clayer2",
match_querystring=True,
body='{"key": "value"}',
status=200,
Expand All @@ -379,7 +379,7 @@ def test_tilequery_with_radius_limit_and_dedupe():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
Expand All @@ -406,7 +406,7 @@ def test_tilequery_with_radius_limit_and_geometry():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
Expand Down Expand Up @@ -438,11 +438,11 @@ def test_tilequery_with_radius_limit_and_layers():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
+ "&layers=layer0%2Clayer1%2Clayer2",
+ "&layers=layer0,layer1%2Clayer2",
match_querystring=True,
body='{"key": "value"}',
status=200,
Expand Down Expand Up @@ -470,7 +470,7 @@ def test_tilequery_with_radius_limit_dedupe_and_geometry():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
Expand Down Expand Up @@ -504,12 +504,12 @@ def test_tilequery_with_radius_limit_dedupe_and_layers():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
+ "&dedupe=true"
+ "&layers=layer0%2Clayer1%2Clayer2",
+ "&layers=layer0,layer1%2Clayer2",
match_querystring=True,
body='{"key": "value"}',
status=200,
Expand Down Expand Up @@ -538,13 +538,13 @@ def test_tilequery_with_radius_limit_dedupe_geometry_and_layers():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test"
+ "&radius=25"
+ "&limit=25"
+ "&dedupe=true"
+ "&geometry=linestring"
+ "&layers=layer0%2Clayer1%2Clayer2",
+ "&layers=layer0,layer1%2Clayer2",
match_querystring=True,
body='{"key": "value"}',
status=200,
Expand Down Expand Up @@ -574,7 +574,7 @@ def test_tilequery_geojson_method():
+ "/v4"
+ "/mapbox.mapbox-streets-v10"
+ "/tilequery"
+ "/0.0%2C1.1.json"
+ "/0.0,1.1.json"
+ "?access_token=pk.test",
match_querystring=True,
body='{"key": "value"}',
Expand Down