Created
February 1, 2025 15:07
-
-
Save dschep/2450cab1958ea0288e89972ee14478c6 to your computer and use it in GitHub Desktop.
Add Raster Overlay to geojson.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(()=>{ | |
if (window.location.host!=='geojson.io') { | |
alert('This bookmarlet only works on geojson.io'); | |
return; | |
} | |
const m = window.api.map; | |
const xyz = prompt("Enter your XYZ Raster Tile URL to overlay"); | |
if (m.getLayer('overlay')) m.removeLayer('overlay'); | |
if (m.getSource('overlay')) m.removeSource('overlay'); | |
m.addSource('overlay', {type: 'raster', tileSize: 256, tiles: [xyz]}); | |
m.addLayer({id: 'overlay', source: 'overlay', type: 'raster'}); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment