question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configuring source, source-layer and filter propertites

See original GitHub issue

Hi there,

I can’t tell from the examples / documentation if your component supports a tileSet configured like this using the Mapbox GL JS library directly:

map.addLayer({
        "id": "my-id",
        "type": "fill",
        "source": "myMapboxHostedTileSetSource",
        "source-layer": "victoriaAustralia",
        "layout": {},
        "paint": {
            "fill-color": "#81D8D0",
            "fill-opacity": 0.5
        },
         "filter": ["==", "sub_region", "Gippsland"]

});

I’m specifically asking about setting the source, source-layer and filter properties. If this is possible could you provide an example and/or clarify in the documentation.

Thanks Charlie

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
charliedotaucommented, Jun 15, 2016

Hi @alex3165. Thanks. Very much appreciated.

I would say that I’ll test it tonight, but I’m a bit stuck. I don’t quite get how I define my source. E.g the equivalent of this:

map.addSource('myMapboxHostedTileSetSource', {
    type: 'vector',
    url: 'mapbox://charlie.4fsn42ds'
});

The bit that most matters here is the URL. And I don’t see where / how I define that with your library. Could you show me an example. Thanks kindly

0reactions
alex3165commented, Jun 16, 2016

Ok well i would suggest you to have multiple geojson files for every sub-regions of Victoria, I have just added the possibility to update the style property of the map, i would do something like this :

// subregions.json

[
  {
    // Geojson for region 1
  },
  {
    // Geojson for region 2
  }
  //...
]


// all-shapes.js

import Subregions from "./subregions.json";

...

onChangeSubRegion(index) {
  this.state({ subregion: index });
}

render() {
  return (
    <ReactMapboxGl
      style={Subregions[this.state.subregion]}
      accessToken={accessToken}
      center={this.state.center}
      containerStyle={containerStyle}>
      ...
    </ReactMapboxGl>
  );
}


React-mapbox-gl API of the layer functionality is more adapted for creating layers and sources that require user interactions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set layer properties—ArcGIS Online Help | Documentation
The Properties pane in Map Viewer provides information about the layers in your map as well as quick access to several layer configuration...
Read more >
source layer | Help - Mapbox docs
A source layer is an individual layer of data within a vector source. A vector source can have multiple source layers. A source...
Read more >
ArcGIS Pro Layer Properties configure and change ... - YouTube
Learn how to configure and set your layer properties on ArcGIS Pro. To Learn more.. Join ArcGIS Professional Package now for 15% discount...
Read more >
Layers and sources | VueMapbox
For example, if you change content of filter prop in GeojsonLayer, changes will be automatically applied to layer on the map. Not all...
Read more >
Filter widget—ArcGIS Experience Builder
Settings · New filter—Create a filter by selecting a data source and adding expressions. The Create new filter panel that opens includes the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found