Skip to content

Zoom levels 1 and 2 produce incorrect tile URLs when using non-mercator projections #1416

Description

@simonmckenzie

Describe the bug

I am experiencing a bug where zoom levels 1 and 2 are producing ESRI tile URLs that look like this:

https://<server>/arcgis/rest/services/<...>/MapServer/tile/r/438/307
https://<server>/arcgis/rest/services/<...>/MapServer/tile/s/438/307

Note the "r" and "s" in place of the zoom levels.

This is caused by changes made in #1411, where _lodMap is set to the literal string "crs":

// if the projection is WGS84, or the developer is using Proj4 to define a custom CRS, no action is required
this._lodMap = "crs";

When getTileUrl runs, it will index into this string:

// try lod map first, then just default to zoom level
z:
this._lodMap && this._lodMap[zoom] !== undefined
? this._lodMap[zoom]
: zoom,
},

For zoom level 1, this produces the "r" ("crs"[1] == "r"), and for zoom level 2, this produces the "s" ("crs"[2] == "s").

Reproduction

https://jsbin.com/fenugafuha/edit?html,output

You can see the "r" in the tile URLs being requested. Once you zoom in past level 2, the tile URLs become correct.

Image

System Info

esri-leaflet: 3.0.19
leaflet: 1.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions