Esri/esri-leaflet-vector

Consider adding vector basemap layers to the tilePane by default

gowin20 opened this issue · 2 comments

Describe the problem

I want to display a custom vector tile layer on top of a vector tile basemap layer - such as in the add a vector tile layer tutorial. Currently I need to manually set the layer pane of the base layer so that my custom data will display atop it:

L.esri.Vector.vectorBasemapLayer(basemapEnum, {
        apiKey: apiKey,
        pane:"tilePane"
      }).addTo(map);

Describe the proposed solution

vectorBasemapLayer objects could be added to the Leaflet tilePane by default. Given that they are a replacement to traditional tile layer basemaps, I believe this would strictly be a quality-of-life enhancement. I can't think of anything this would break, and there are many instances where you want to display vector tile layers on top of a vector basemap.

According to the leaflet documentation, the overlayPane (where vectorBaseLayers are currently added) is meant "for Vectors, ImageOverlays, and VideoOverlays".

I understand that the vector basemap layer traditionally should go in the pane meant for vectors. However, the purpose of basemap layers is to provide a base for data to be displayed atop it. It makes no sense for basemap layers to display in the same pane as all other vector data.

Leaflet's default panes, for reference:
image

Alternatives considered

This is a quality-of-life change. The alternative is for users to manually assign the vectorBasemapLayer to the tilePane, or to create their own map pane for custom vector tile data.

Additional Information

No response

gavinr commented

Fixed in v4.1.0.