Skip to content

Commit

Permalink
New Window with GeoJSON URL
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabs committed Aug 28, 2024
1 parent 99f4c6d commit e1caa77
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ui/file_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ module.exports = function fileBar(context) {
meta.adduserlayer(context, layerURL, layerName);
}
},
{
title: '🪟 New Window with GeoJSON URL',
action: function () {
const geojsonURL = prompt(
'Load GeoJSON data from a URL\n\n Warning this will open a new window 🪟'
);
if (geojsonURL === null) return;

const encodedURL = encodeURIComponent(geojsonURL);
const openURL = `${window.location.origin}${window.location.pathname}#data=data:text/x-url,${encodedURL}`;
console.log(openURL);
window.open(openURL);
}
},
{
title: 'Zoom to features',
alt: 'Zoom to the extent of all features',
Expand Down

0 comments on commit e1caa77

Please sign in to comment.