maps icon indicating copy to clipboard operation
maps copied to clipboard

Update VectorSource.tsx comment

Open SethArchambault opened this issue 2 years ago • 2 comments

Description

Made clear that maxZoomLevel doesn't actually hide the data. Setting this can actually help reveal data! This was quite surprising to find, with the doc written as they were.

Used the language here: https://docs.mapbox.com/style-spec/reference/sources/#vector-maxzoom

So adding 13 to the VectorSource's maxZoomLevel here, actually allowed the LineLayer to keep showing data. I guess because the url the titleUrlTemplate was pointing at did not provide data beyond 13, so it's essentially caching it.

    <ErrorBoundary>
      <MapboxGL.VectorSource
        id={sourceId}
        tileUrlTemplates={[url,]}
        maxZoomLevel={13}
      >
        <MapboxGL.LineLayer
          id={lineLayerId}
          sourceLayerID={sourceId}
          style={{
            visibility:  visibility,
            lineColor:   lineColor,
            lineWidth:   ['interpolate', ['linear',], ['zoom',], 16, 0.8, 18, 5,],
            lineOpacity: ['interpolate', ['linear',], ['zoom',], 16, 0.8, 18, 1,],
          }}
          minZoomLevel={11}
        />

Checklist

  • [x] I have tested this on a device/simulator for each compatible OS
  • [na] I updated the documentation with running yarn generate in the root folder
  • [ na] I added/updated a sample - if a new feature was implemented (/example)

SethArchambault avatar Sep 14 '23 16:09 SethArchambault

@SethArchambault thanks much. Please note that this is a generated .md file, you need to change in the source code comments

mfazekas avatar Sep 15 '23 05:09 mfazekas