opengis: adjust WMS feature info endpoint to work next to area limits (#34261)

This commit is contained in:
Frédéric Péters 2019-06-24 13:16:44 +02:00
parent b4aad9cd5f
commit f39ee81884
2 changed files with 6 additions and 6 deletions

View File

@ -218,8 +218,8 @@ class OpenGIS(BaseResource):
'lon': {'description': _('Longitude'), 'example_value': '4.78414'},
})
def feature_info(self, request, lat, lon):
lon_b, lat_b = float(lon) + 0.002, float(lat) + 0.002
bbox = self.get_bbox(lon, lat, lon_b, lat_b)
lat, lon = float(lat), float(lon)
bbox = self.get_bbox(lon - 0.001, lat - 0.001, lon + 0.001, lat + 0.001)
params = {
'VERSION': '1.3.0',
'SERVICE': 'WMS',
@ -228,8 +228,8 @@ class OpenGIS(BaseResource):
'STYLES': '',
'I': '0',
'J': '0',
'HEIGHT': '500',
'WIDTH': '500',
'HEIGHT': '20',
'WIDTH': '20',
'CRS': self.projection,
'LAYERS': self.query_layer,
'QUERY_LAYERS': self.query_layer,

View File

@ -246,7 +246,7 @@ def test_feature_info(mocked_get, app, connector):
assert endpoint == '/opengis/test/feature_info'
mocked_get.return_value = utils.FakedResponse(content=FAKE_FEATURE_INFO, status_code=200)
resp = app.get(endpoint, params={'lat': '45.796890', 'lon': '4.784140'})
assert mocked_get.call_args[1]['params']['BBOX'] == '532568.028684,5747860.22776,532790.667665,5748179.56467'
assert mocked_get.call_args[1]['params']['BBOX'] == '532456.709193,5747700.5636,532679.348175,5748019.89478'
assert mocked_get.call_args[1]['params']['CRS'] == 'EPSG:3857'
assert (resp.json['data']
['cad_cadastrecadparcelle_layer']
@ -256,7 +256,7 @@ def test_feature_info(mocked_get, app, connector):
connector.projection = 'EPSG:4326'
connector.save()
resp = app.get(endpoint, params={'lat': '45.796890', 'lon': '4.784140'})
assert mocked_get.call_args[1]['params']['BBOX'] == '45.796890,4.784140,45.79889,4.78614'
assert mocked_get.call_args[1]['params']['BBOX'] == '45.79589,4.78314,45.79789,4.78514'
assert mocked_get.call_args[1]['params']['CRS'] == 'EPSG:4326'