opengis: fix reverse endpoint with bad params (#79136)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
64b25c7c73
commit
2775202bd8
|
@ -248,7 +248,10 @@ class OpenGIS(BaseResource):
|
|||
raise APIError('OpenGIS Error: %s' % exception_code or 'unknown code', data={'text': content})
|
||||
|
||||
def convert_coordinates(self, lon, lat, reverse=False):
|
||||
lon, lat = float(lon), float(lat)
|
||||
try:
|
||||
lon, lat = float(lon), float(lat)
|
||||
except ValueError:
|
||||
raise APIError('Wrong parameters lon, lat: %s, %s' % (lon, lat))
|
||||
if self.projection != 'EPSG:4326':
|
||||
wgs84 = pyproj.Proj(init='EPSG:4326')
|
||||
target_projection = pyproj.Proj(init=self.projection)
|
||||
|
|
|
@ -666,6 +666,10 @@ def test_reverse_geocoding(mocked_get, app, connector):
|
|||
)
|
||||
assert not resp.json['err']
|
||||
|
||||
resp = app.get(endpoint, params={'lat': 'lat=45.1893469606986', 'lon': '5.72462060798'})
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == 'Wrong parameters lon, lat: 5.72462060798, lat=45.1893469606986'
|
||||
|
||||
connector.projection = 'EPSG:4326'
|
||||
connector.search_radius = 10
|
||||
connector.save()
|
||||
|
|
Loading…
Reference in New Issue