How to create a geojson vector tile layer?
Closed this issue · 4 comments
How can I create a geojson vector tile layer?
I was hoping to do something like:
map.addSource('projectSource', {
'type': 'geojson',
'data': layerAttributes,
});
and then using the source, create a layer:
map.addLayer({
'id': transparentLayer,
'type': 'point',
'source': 'projectSource',
"source-layer": "eq-simple",
'interactive': true
});
After adding the GL layer to a map, you have access to it through glLayer._glMap
. We should expose it more publicly though.
Thanks, worked!
gl._glMap.addSource('projectSource', {
'type': 'geojson',
'data': layerAttributes,
});
This worked great for the mainpart of my existing mapbox gl js stuff! It does show my gl source markers layer.
I also tried this:
gl._glMap.on('click', function (e) {
gl._glMap.featuresAt(e.point, {radius: 15, layer: 'markers', includeGeometry: true}, function (err, features) {
if (err) throw err;
ETC.
Which also worked fine in mapbox gl js, but now it does not. It does not give an error message but no popup shows when I click on a gl sourced markers layer as it used to do within mapbox gl js. Is this because the click sensitivity just relates to leaflet container and not to the gl layer? Can this be made to work somehow?
@musicformellons If you still need an answer to this issue, please check out the code example in #36