Skip to content

Instantly share code, notes, and snippets.

@dschep
Created February 1, 2025 15:07
Show Gist options
  • Save dschep/2450cab1958ea0288e89972ee14478c6 to your computer and use it in GitHub Desktop.
Save dschep/2450cab1958ea0288e89972ee14478c6 to your computer and use it in GitHub Desktop.
Add Raster Overlay to geojson.io
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