I'm trying to use a tileserver in my leaflet app that encodes maps in EPSG:4326.
I understand that I need to use Proj4Leaflet, and I'm setting up my CRS as follows:
const crs = new Leaflet.Proj.CRS(
'EPSG:4326',
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +type=crs',
{
resolutions: [
0.3515625065578945,
0.17578125327894775,
0.08789062663947399,
0.043945313319736994,
0.021972656659868472,
0.010986328329934226,
],
origin: [-180, 90],
}
);
But, when I do this, I just see the 1 earth (and get invalid tileserver requests like:
tiles/bright_pc/1/-1/0.png
)
How can I wrap the map, like Leaflet does automatically for EPSG:3857?
Best Answer
Instead of defining your own
EPSG:4326
, just use projection that is already available in Leaflet:L.CRS.EPSG4326
.See Defined CRSs section at https://leafletjs.com/reference.html#crs.