TransWikia.com

How to extract and parse property from Mapbox vector tileset?

Geographic Information Systems Asked by linden on March 7, 2021

I have a Mapbox vector tileset (counties) from which I need to extract a property (p). It should be an array, but AFAIK Mapbox doesn’t support array properties (right?); it turns them into strings. So I’d like to store the property in a variable and parse the strings to arrays. Something like this

var c2 = map.getSource('counties').features;
c2.forEach(function(county){
     county.properties.p = JSON.parse(county.properties.p);
});

But map.getSource('counties').features; does not work. Is there a way I can store the properties from my tileset?

This might be a duplicate of Storing a Mapbox-hosted vector tileset in a variable (Mapbox-GL-JS)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP