Regression: Accept layer option in the static map urls
This commit is contained in:
parent
db946b93ec
commit
102244f467
@ -11,7 +11,7 @@ Begin by instantiating either a Named or Anonymous Map using the `layergroupid t
|
||||
#### Definition
|
||||
|
||||
```bash
|
||||
GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format}
|
||||
GET /api/v1/map/static/center/{token}/{z}/{lat}/{lng}/{width}/{height}.{format}{{?}extra_options}
|
||||
```
|
||||
|
||||
#### Params
|
||||
@ -58,6 +58,9 @@ Note: you can see this endpoint as
|
||||
GET /api/v1/map/static/bbox/{token}/{west},{south},{east},{north}/{width}/{height}.{format}`
|
||||
```
|
||||
|
||||
#### Extra options
|
||||
* Layer: List of layers to be shown in the image (by default `all`), for example `?layer=0,1`.
|
||||
|
||||
### Named Map
|
||||
|
||||
#### Definition
|
||||
|
@ -10,12 +10,13 @@ module.exports = function createMapStoreMapConfigProvider (
|
||||
return function createMapStoreMapConfigProviderMiddleware (req, res, next) {
|
||||
const { user, token, cache_buster, api_key } = res.locals;
|
||||
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
|
||||
const { layer, z, x, y, scale_factor, format } = req.params;
|
||||
const { layer: layerFromParams, z, x, y, scale_factor, format } = req.params;
|
||||
const { layer: layerFromQuery } = req.query;
|
||||
|
||||
const params = {
|
||||
user, token, cache_buster, api_key,
|
||||
dbuser, dbname, dbpassword, dbhost, dbport,
|
||||
layer, z, x, y, scale_factor, format
|
||||
layer: (layerFromQuery || layerFromParams), z, x, y, scale_factor, format
|
||||
};
|
||||
|
||||
if (forcedFormat) {
|
||||
|
@ -261,6 +261,27 @@ describe('named-maps analysis', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('should fail to retrieve static map preview via layergroup ' +
|
||||
'when filtering by invalid layers', function(done) {
|
||||
assert.response(
|
||||
server,
|
||||
{
|
||||
url: '/api/v1/map/static/center/' + layergroupid + '/4/42/-3/320/240.png?layer=1',
|
||||
method: 'GET',
|
||||
encoding: 'binary',
|
||||
headers: {
|
||||
host: username
|
||||
}
|
||||
},
|
||||
{
|
||||
status: 400
|
||||
},
|
||||
function(res, err) {
|
||||
done(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return and an error requesting unsupported image format', function(done) {
|
||||
assert.response(
|
||||
server,
|
||||
|
Loading…
Reference in New Issue
Block a user