Skip to content

Commit cdd92cd

Browse files
authored
FIX: numpy floats parsed incorrectly (#955)
* FIX: numpy floats parsed incorrectly * TST: add test_build_getmap_request_bbox_precision
1 parent c71c5f7 commit cdd92cd

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

owslib/coverage/wcs110.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def getCoverage(self, identifier=None, bbox=None, time=None, format=None, store=
176176
request['identifier'] = identifier
177177
# request['identifier'] = ','.join(identifier)
178178
if bbox:
179-
request['boundingbox'] = ','.join([repr(x) for x in bbox])
179+
request['boundingbox'] = ','.join([str(x) for x in bbox])
180180
if time:
181181
request['timesequence'] = ','.join(time)
182182
request['format'] = format

owslib/feature/wfs100.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def getfeature(
268268
if featureid:
269269
request["featureid"] = ",".join(featureid)
270270
elif bbox and typename:
271-
request["bbox"] = ",".join([repr(x) for x in bbox])
271+
request["bbox"] = ",".join([str(x) for x in bbox])
272272
elif filter and typename:
273273
request["filter"] = str(filter)
274274

owslib/map/wms111.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __build_getmap_request(self, layers=None, styles=None, srs=None, bbox=None,
172172
request['height'] = str(size[1])
173173

174174
request['srs'] = str(srs)
175-
request['bbox'] = ','.join([repr(x) for x in bbox])
175+
request['bbox'] = ','.join([str(x) for x in bbox])
176176
request['format'] = str(format)
177177
request['transparent'] = str(transparent).upper()
178178
request['exceptions'] = str(exceptions)

owslib/map/wms130.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __build_getmap_request(self, layers=None, styles=None, srs=None, bbox=None,
182182

183183
# remapping the srs to crs for the request
184184
request['crs'] = str(srs)
185-
request['bbox'] = ','.join([repr(x) for x in bbox])
185+
request['bbox'] = ','.join([str(x) for x in bbox])
186186
request['format'] = str(format)
187187
request['transparent'] = str(transparent).upper()
188188
request['exceptions'] = str(exceptions)

tests/test_wms_getmap.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from tests.utils import service_ok
55

66
from owslib.wms import WebMapService
7+
from owslib.map.wms130 import WebMapService_1_3_0
78
from owslib.util import ServiceException
89
from owslib.util import ResponseWrapper
910

@@ -12,6 +13,26 @@
1213
NCWMS2_URL = "http://wms.stccmop.org:8080/ncWMS2/wms"
1314

1415

16+
@pytest.fixture
17+
def wms():
18+
return WebMapService_1_3_0(SERVICE_URL, version='1.3.0')
19+
20+
21+
def test_build_getmap_request_bbox_precision(wms):
22+
bbox = (-126.123456789, 24.123456789, -66.123456789, 50.123456789)
23+
bbox_yx = (bbox[1], bbox[0], bbox[3], bbox[2])
24+
request = wms._WebMapService_1_3_0__build_getmap_request(
25+
layers=['layer1'],
26+
styles=['default'],
27+
srs='EPSG:4326',
28+
bbox=bbox,
29+
format='image/jpeg',
30+
size=(250, 250),
31+
transparent=True
32+
)
33+
assert request['bbox'] == ','.join(map(str, bbox_yx))
34+
35+
1536
@pytest.mark.online
1637
@pytest.mark.skipif(not service_ok(SERVICE_URL),
1738
reason="WMS service is unreachable")

0 commit comments

Comments
 (0)