Middlewarify attributes endpoint
This commit is contained in:
parent
d8a4209768
commit
ca56df5cfe
@ -79,7 +79,8 @@ LayergroupController.prototype.register = function(app) {
|
||||
cors(),
|
||||
userMiddleware,
|
||||
this.prepareContext,
|
||||
this.attributes.bind(this)
|
||||
this.getMapStoreMapConfigProvider(this.mapStore, this.userLimitsApi),
|
||||
this.attributes(this.attributesBackend)
|
||||
);
|
||||
|
||||
app.get(
|
||||
@ -229,30 +230,23 @@ LayergroupController.prototype.dataviewSearch = function (dataviewBackend) {
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
LayergroupController.prototype.attributes = function(req, res, next) {
|
||||
var self = this;
|
||||
LayergroupController.prototype.attributes = function (attributesBackend) {
|
||||
return function attributesMiddleware (req, res, next) {
|
||||
req.profiler.start('windshaft.maplayer_attribute');
|
||||
|
||||
req.profiler.start('windshaft.maplayer_attribute');
|
||||
const { mapConfigProvider } = res.locals;
|
||||
|
||||
step(
|
||||
function retrieveFeatureAttributes() {
|
||||
var mapConfigProvider = new MapStoreMapConfigProvider(
|
||||
self.mapStore, res.locals.user, self.userLimitsApi, res.locals
|
||||
);
|
||||
self.attributesBackend.getFeatureAttributes(mapConfigProvider, res.locals, false, this);
|
||||
},
|
||||
function finish(err, tile, stats) {
|
||||
attributesBackend.getFeatureAttributes(mapConfigProvider, res.locals, false, (err, tile, stats) => {
|
||||
req.profiler.add(stats || {});
|
||||
|
||||
if (err) {
|
||||
err.label = 'GET ATTRIBUTES';
|
||||
next(err);
|
||||
} else {
|
||||
self.sendResponse(req, res, tile, 200);
|
||||
return next(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.sendResponse(req, res, tile, 200);
|
||||
});
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
// Gets a tile for a given token and set of tile ZXY coords. (OSM style)
|
||||
|
Loading…
Reference in New Issue
Block a user