Skip to main content
100%

Leaflet styling source to black&white/grayscale on client side

✓ Published0🌍 Public
TThomasG77
Last edited Nov 8, 2024
Created on Nov 8, 2024

This example displays an interactive Leaflet map centered on a location near Paris, using the IGN-F/Géoportail WMTS tile service as its basemap. The map shows the “GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2” layer, yet a CSS class applied to the tile layer renders those tiles in black and white. The styling is achieved via the Leaflet `L.tileLayer` API, passing a `className: "bw"`, which triggers a CSS filter of `grayscale(100%) opacity(80%)` on the tile container. The map is created with `L.map("viewerDiv").setView([48.845,2.424],10)`.

AI-generated description

Similar vizzes