MapboxVectorLayer does not correctly set additional options
See original GitHub issueDescribe the bug
If I pass an additional property to a MapboxVectorLayer, layer.get(‘customProp’) does not return it.
For example:
const layer = new MapboxVector({
type: 'ol/layer/MapboxVector',
styleUrl: 'mapbox://styles/mapbox/light-v10',
accessToken: 'xxxx',
id: 'mapbox-gray',
});
layer.get('id') // -> undefined
Expected behavior
Most (if not all) other openlayers layer objects allow this. The use case is that I can populate the layer with some additional metadata that lets me find the layer in the future. I think that to ensure consistency in the API the mapbox layer should also allow this.
I am able to contribute a pull request if this is an acceptable solution.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Styles | Mapbox Studio manual
There are several options to add a new layer to your style: Source, Upload data, Add tileset by ID, Convert to background layer,...
Read more >Recipe specification | Mapbox Tiling Service
A tileset recipe is a JSON document containing configuration options that tell Mapbox Tiling Service (MTS) how to turn tileset source data into...
Read more >Upload data to Mapbox | Help
To add your data to a dataset, you can create a new, blank dataset through Mapbox Studio or through the Mapbox Datasets API...
Read more >Properties and options | Mapbox GL JS
Set the map's access token, test whether the browser support Mapbox GL JS, ... These layers can be added between any regular layers...
Read more >Data-driven styling | Maps SDK v9 | Android - Mapbox docs
Adding a source won't instantly make data appear on the map because sources ... All layers that use a vector source must specify...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As arbitrary user properties are accessed using
getProperties()
andsetProperties()
then in constructors instead ofname: 'My Layer',
it would be more logical to use
properties: {name: 'My Layer'},
In the case of features it would make OpenLayers features more consistent with GeoJSON features and avoid ambiguities in the use of geometry, id and style.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.