Skip to content

Instantly share code, notes, and snippets.

@torjusti
Last active April 20, 2025 17:05
Show Gist options
  • Save torjusti/ce61d1733616ea63853245b17d9b4bd6 to your computer and use it in GitHub Desktop.
Save torjusti/ce61d1733616ea63853245b17d9b4bd6 to your computer and use it in GitHub Desktop.
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="https://kartena.github.io/Proj4Leaflet/lib/proj4-compressed.js"></script>
<script src="https://kartena.github.io/Proj4Leaflet/src/proj4leaflet.js"></script>
<div id="map" style="height: 1000px"></div>
<script>
const originX = -35597500;
const originY = 48953100;
const tileSize = 256;
const minZoom = 1;
const maxZoom = 12;
const resolutions = [
305.7480111760223,
152.87400558801116,
76.43700279400558,
38.21850139700279,
19.109250698501395,
9.554625349250697,
4.777312674625349,
2.3886563373126743,
1.1943281686563372,
0.5971640843281686,
0.2985820421640843,
0.14929102108204215,
0.07464551054102107,
];
L.tileLayer.IGCLayer = function(templateUrl, options) {
return new L.TileLayer.IGCLayer(templateUrl, options);
}
const customCRS = new L.Proj.CRS('EPSG:2154', '+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs', {
origin: [originX, originY],
resolutions
});
const map = L.map('map', { crs: customCRS }).setView([48.83441454329651, 2.3312172934455537], 11);
const esriLayer = L.tileLayer("https://capgeo2.paris.fr/public/rest/services/IGC/IGC_Atlas_carrieres_image/MapServer/tile/{z}/{y}/{x}", {
tileSize,
maxZoom,
minZoom,
}).addTo(map);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment