I am trying to access a VectorTile layers attributes in Openlayers3 like this example. The layer is being server by 'Chubbs'
The layer:
var observationLayer = new ol.layer.VectorTile({
source: new ol.source.VectorTile({
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
tilePixelRatio: 16,
url: '/services/postgis/test_observations/geometry/vector-tiles/{z}/{x}/{y}.pbf'
}),
style: observationStyle
});
Trying to get the attributes when the mouse hovered over the point:
function onMouseMove(browserEvent) {
var coordinate = browserEvent.coordinate;
var pixel = map.getPixelFromCoordinate(coordinate);
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
// Small sub set of all the things I have tried...
console.log('feature:');
console.log(feature); // returns the features!
console.log('layer:');
console.log(layer); // returns the layer!
console.log('layer.getProperties():');
console.log(layer.getProperties()); // returns the prope
var source = layer.getSource();
console.log('source:');
console.log(source);
var properties = source.getProperties();
console.log('properties:');
console.log(properties); // returns an empty object
});
}
map.on('pointermove', onMouseMove);
feature.getProperties()
?feature.getProperties()
, but it only returns: id: "test_observations_geometry" instead of all of the layers attributes. If I change the layer to a GeoJSON source, then it works correctly.