// ==UserScript== // @author DanielOnDiordna // @name IITC plugin: Dutch Kadaster map layers // @category Map Tiles // @version 1.0.0.20231128.234100 // @updateURL https://softspot.nl/ingress/plugins/iitc-plugin-kadastermaps.meta.js // @downloadURL https://softspot.nl/ingress/plugins/iitc-plugin-kadastermaps.user.js // @description [danielondiordna-1.0.0.20231128.234100] Add a map and overlay of Dutch Kadaster maps from PDOK.nl // @id iitc-plugin-kadastermaps@danielondiordna // @namespace https://softspot.nl/ingress/ // @match https://intel.ingress.com/* // @namespace https://softspot.nl/ingress/ // @match https://intel-x.ingress.com/* // @grant none // ==/UserScript== function wrapper(plugin_info) { // ensure plugin framework is there, even if iitc is not yet loaded if(typeof window.plugin !== 'function') window.plugin = function() {}; // use own namespace for plugin window.plugin.kadastermaps = function() {}; var self = window.plugin.kadastermaps; self.id = 'kadastermaps'; self.title = 'Kadaster maps'; self.version = '1.0.0.20231128.234100'; self.author = 'DanielOnDiordna'; self.changelog = ` Changelog: version 1.0.0.20231128.234100 - first release - added kadaster map and overlay and the required attributions from https://pdok.nl/ `; self.namespace = 'window.plugin.' + self.id + '.'; self.pluginname = 'plugin-' + self.id; self.setup = function () { let L_KadasterTileLayer = window.L.TileLayer.extend({ options: { type: 'png', minZoom: 0, maxZoom: 21, maxNativeZoom: 19, attribution: 'PDOK nationaalgeoregister.nl Map data: Kadaster' }, initialize: function (name, options) { window.L.TileLayer.prototype.initialize.call(this, options.url, options); } }); function addLayer(name,url,options) { options = options || {}; options.url = url; options.bbox = function(options) { return xyzToBounds(options.x,options.y,options.z); }; window.layerChooser.addBaseLayer(new L_KadasterTileLayer(name,options),name); } const EXTENT = [-Math.PI * 6378137, Math.PI * 6378137]; function xyzToBounds(x, y, z) { const tileSize = EXTENT[1] * 2 / Math.pow(2, z); const minx = EXTENT[0] + x * tileSize; const maxx = EXTENT[0] + (x + 1) * tileSize; // remember y origin starts at top const miny = EXTENT[1] - (y + 1) * tileSize; const maxy = EXTENT[1] - y * tileSize; return [minx, miny, maxx, maxy]; } function addOverlay(name,url,options) { options = options || {}; options.url = url; options.bbox = function(options) { return xyzToBounds(options.x,options.y,options.z); }; window.addLayerGroup(name,new L_KadasterTileLayer(name,options),false); } addLayer('Kadaster luchtfoto','https://service.pdok.nl/hwh/luchtfotorgb/wms/v1_0?&service=WMS&request=GetMap&layers=Actueel_orthoHR&styles=&format=image%2Fjpeg&transparent=false&version=1.3.0&width=256&height=256&crs=EPSG%3A3857&bbox={bbox}'); // Raster Layer Groups - Separate overlays: // setup detail overlays last, so these overlayes can be drawn over other layers addOverlay('Kadaster Overlay','https://service.pdok.nl/kadaster/kadastralekaart/wms/v5_0?&service=WMS&request=GetMap&layers=Perceel%2CNummeraanduidingreeks&styles=&format=image%2Fpng&transparent=true&version=1.3.0&width=256&height=256&crs=EPSG%3A3857&bbox={bbox}',{maxNativeZoom:17}); }; function setup() { self.setup(); console.log('IITC plugin loaded: ' + self.title + ' version ' + self.version); } // Added to support About IITC details and changelog: plugin_info.script.version = plugin_info.script.version.replace(/\.\d{8}\.\d{6}$/,''); plugin_info.buildName = 'softspot.nl'; plugin_info.dateTimeVersion = self.version.replace(/^.*(\d{4})(\d{2})(\d{2})\.(\d{6})/,'$1-$2-$3-$4'); plugin_info.pluginId = self.id; let changelog = [{version:'This is a softspot.nl plugin by ' + self.author,changes:[]},...self.changelog.replace(/^.*?version /s,'').split(/\nversion /).map((v)=>{v=v.split(/\n/).map((l)=>{return l.replace(/^- /,'')}).filter((l)=>{return l != "";}); return {version:v.shift(),changes:v}})]; setup.info = plugin_info; //add the script info data to the function as a property if (typeof changelog !== 'undefined') setup.info.changelog = changelog; if(!window.bootPlugins) window.bootPlugins = []; window.bootPlugins.push(setup); // if IITC has already booted, immediately run the 'setup' function if(window.iitcLoaded && typeof setup === 'function') setup(); } // wrapper end // inject code into site context var script = document.createElement('script'); var info = {}; if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');')); (document.body || document.head || document.documentElement).appendChild(script);