Giter Site home page Giter Site logo

Comments (6)

mfazekas avatar mfazekas commented on May 8, 2024 1

@systemlevel with #57 you should be able to declare in any order and RNMapbox should wait for the layer to be inserted bellow.

from maps.

mfazekas avatar mfazekas commented on May 8, 2024

See also nitaliano/react-native-mapbox-gl#1135.

The issue is that at the time #customSourceFill added to the map, the #aboveLayerID is not yet added to the map therefore it will not find the layer and that's the cause of crash.

Ideally in such cases we'd defer the insertion until the referred layer is added

from maps.

systemlevel avatar systemlevel commented on May 8, 2024

@mfazekas Thank you for that insight. What is the best way to ensure a layer is added to the map? Does the order in which I define the layers have any impact on that order?

For example, if I were to switch these layers around:

       <Mapbox.RasterSource id="rasterSourceBasemap" tileSize={256} url={url}>
          <Mapbox.RasterLayer
            id="basemap"
            sourceID="rasterSourceBasemap"
            style={{rasterOpacity: 1}}
          />
        </Mapbox.RasterSource>

        <Mapbox.VectorSource
          id="customSourceExample"
          url={VECTOR_SOURCE_URL}
        >
          <Mapbox.FillLayer
            id="customSourceFill"
            sourceLayerID="roadless"
            style={mbStyles.boxFill}
            aboveLayerID="basemap"
          />
        </Mapbox.VectorSource>

Would that load in the proper order?

from maps.

mfazekas avatar mfazekas commented on May 8, 2024

@systemlevel yep that should work.

from maps.

systemlevel avatar systemlevel commented on May 8, 2024

@mfazekas Excellent update. Thank you. That is perfect!

from maps.

systemlevel avatar systemlevel commented on May 8, 2024

@mfazekas Doing some more testing on this tonight. I'm still having some issues getting the aboveLayerID property working.

Here is some more context:

  1. We have made a custom style map in mapbox studio
  2. We have added various vector layers to that mapbox studio map (these are layers we uploaded into studio)
  3. When I try to order those layers in the react-native-mapbox-gl client they don't seem to respond to the order I try to define whether it be via aboveLayerID or layerIndex.

I'm able to control the visibility but I'm unable to control where they sit in relation to the RasterSource layer:

       <Mapbox.RasterSource id="rasterSourceBasemap" tileSize={256} url={url}>
          <Mapbox.RasterLayer
            id="basemap"
            sourceID="rasterSourceBasemap"
            style={{rasterOpacity: 1}}
          />
        </Mapbox.RasterSource>

from maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.