From 04ff7a857a0c306af44341da8878de66aa7e4935 Mon Sep 17 00:00:00 2001 From: Atle Frenvik Sveen Date: Wed, 11 Nov 2015 16:36:42 +0100 Subject: [PATCH] fixes and docs for enkeltminner (ref #132) --- api_doc.md | 11 +++++++++++ common/js/datasets.js | 2 +- dist/scripts.js | 5 +++-- dist/scripts.min.js | 2 +- dist/scripts3d.js | 5 +++-- dist/scripts3d.min.js | 2 +- dist/scripts_external.js | 2 +- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/api_doc.md b/api_doc.md index 54655d27..ee423601 100644 --- a/api_doc.md +++ b/api_doc.md @@ -62,6 +62,8 @@ The DatasetWrapper passed to the DatasetLoader is a wrapper around the Dataset o | loadWhenLessThan | dict | null | no | If set, with params ``count`` (int) and ``callback`` (function) will call callback when there are less than count features on the map, callback is called with ``map``, ``dataset`` and ``features`` | | allowTopic | bool | false | no | For Norvegiana-datasets: should the user be able to set a "topic" in the generator | | feedbackForm | bool | false | no | Should the dataset display a feedback-form when viewing an item in the sidebar? | +| showEnkeltminner | bool | true | no | Applies to ra sparql, and requires loadWhenLessThan to be set. Queries for enkeltminner when clicking on polygon | +| enkeltminner | enkeltMinneOpts| defaults | no | See, sets style for enkeltminne | ***toPointOptions*** @@ -88,6 +90,15 @@ This is a dict, with style properties: fillcolor and bordercolor may also be a function that takes a feature and returns a hex string (in the form #RRGGBB) +***enkeltMinneOpts*** +Options for enkeltminne + +* style: a leaflet style dict (default: {color: '#fff', weight: 1, fillColor: '#B942D0'};) +* sidebarColor: color used in sidebar (default: #B942D0) +* provider: providertext for sidebar (default: "Enkeltminer") +* template: template used for sidebar render (default: /templates/datasets/ra_enkeltminne.tmpl) + + ***KR.setupMap*** The ``KR.setupMap`` is a utility-function for setting up a map with datasets and options. The signature is diff --git a/common/js/datasets.js b/common/js/datasets.js index 5e7038e1..f8665629 100644 --- a/common/js/datasets.js +++ b/common/js/datasets.js @@ -56,7 +56,7 @@ KR.Config = KR.Config || {}; color: '#fff', weight: 1, fillColor: '#B942D0' - } + }; enkeltMinneLayer = L.geoJson(null, { onEachFeature: function (feature, layer) { diff --git a/dist/scripts.js b/dist/scripts.js index 5bb923f5..ee5422e1 100644 --- a/dist/scripts.js +++ b/dist/scripts.js @@ -3189,7 +3189,7 @@ KR.Config = KR.Config || {}; color: '#fff', weight: 1, fillColor: '#B942D0' - } + }; enkeltMinneLayer = L.geoJson(null, { onEachFeature: function (feature, layer) { @@ -3609,7 +3609,8 @@ KR.Config = KR.Config || {}; count: 10, callback: kulturminneFunctions.loadKulturminnePoly }, - description: 'Data fra Riksantikvarens kulturminnesøk' + description: 'Data fra Riksantikvarens kulturminnesøk', + showEnkeltminner: false }, 'brukerminner': { name: 'Kulturminnesøk - brukerregistreringer', diff --git a/dist/scripts.min.js b/dist/scripts.min.js index c3b2938d..5bf5a146 100644 --- a/dist/scripts.min.js +++ b/dist/scripts.min.js @@ -1,2 +1,2 @@ var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style),L.Knreise=L.Knreise||{},L.Knreise.MarkerClusterGroup=L.MarkerClusterGroup.extend({options:{zoomToBoundsOnClick:!1,spiderfyOnMaxZoom:!1,polygonOptions:{fillColor:"#ddd",weight:2,color:"#999",fillOpacity:.6}},initialize:function(a){L.Util.setOptions(this,a),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._iconCreator.bind(this)),this._featureGroup=L.featureGroup(),this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this.on("clusterclick",this._clusterClicked,this)},onAdd:function(a){L.MarkerClusterGroup.prototype.onAdd.apply(this,arguments),a.on("layerSelected",this._deselectAll,this)},_deselectAll:function(){_.each(this._gridClusters,function(a){_.each(a._grid,function(a){_.each(a,function(a){_.each(a,function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a._updateIcon(),a.selected=!1)})})})}),this.eachLayer(function(a){a.selected&&(a.createIcon=_.bind(L.MarkerCluster.prototype.createIcon,a),a.setIcon(_.bind(L.Knreise.GeoJSON.prototype._createFeatureIcon,this)(a.feature)),a.selected=!1)},this)},_clusterClicked:function(a){this._map.fire("layerSelected");var b=a.layer,c=_.bind(this._iconCreator,this);b.createIcon=function(){return c(this,!0).createIcon()},b.selected=!0,b._updateIcon()},_iconCreator:function(a,b){return KR.Style.getClusterIcon(a,b)}}),L.Knreise.markerClusterGroup=function(a){return new L.Knreise.MarkerClusterGroup(a)},L.Knreise=L.Knreise||{},L.Knreise.GeoJSON=L.GeoJSON.extend({initialize:function(a,b){L.setOptions(this,b),this._layers={},this.options.pointToLayer=this._pointToLayer.bind(this),a&&this.addData(a),this.on("click",this._featureClicked,this),this._selectedLayer=null},removedPaths:[],isCollapsed:function(a,b){var c=this.options.dataset.toPoint.minSize||20,d=a.getBounds(),e=this._map.project(d.getNorthEast(),b),f=this._map.project(d.getSouthWest(),b),g=e.x-f.x,h=f.y-e.y;return c>h||c>g},_deselectAll:function(){if(this._selectedLayer){var a=this._selectedLayer;if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}this._selectedLayer=null}},deselectAllNew:function(){_.each(this.getLayers(),function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!1)),a.setZIndexOffset(0)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(a.setStyle(this._createFeatureIcon(b,!1)),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!1))}}},this)},setLayerSelected:function(a){if(a.setIcon&&(a.setIcon(this._createFeatureIcon(a.feature,!0)),a.setZIndexOffset(1e3)),a.setStyle){var b=a.feature;if(!b){var c=this.getParentLayer(a._leaflet_id);b=c.feature}if(b&&(a.setStyle(this._createFeatureIcon(b,!0)),a.bringToFront()),a.getParent){var d=a.getParent();d.setStyle(this._createFeatureIcon(b,!0))}}this._selectedLayer=a},_featureClicked:function(a){if(!(this.options.dataset&&this.options.dataset.toPoint&&this.options.dataset.toPoint.stopPolyClick&&"Point"!==a.layer.toGeoJSON().geometry.type)){a.layer._map&&a.layer._map.fire("layerSelected");var b=a.layer;this.setLayerSelected(b)}},getParentLayer:function(a){var b=this._layers[a];if(b)return b;var c,d,e;for(c in this._layers)if(this._layers.hasOwnProperty(c)&&(d=this._layers[c],d.getLayer&&(e=d.getLayer(a))))return d},getZoomThreshold:function(a){var b=null,c=this._map.getZoom();if(this.isCollapsed(a,this._map.getZoom()))for(;!b;)c+=1,this.isCollapsed(a,c)||(b=c-1);else for(;!b;)c-=1,this.isCollapsed(a,c)&&(b=c);return b},_zoomend:function(){if(this.options.dataset.toPoint){var a,b,c=[];for(this.eachLayer(function(a){this._map.getZoom()<=a.zoomThreshold&&(this.removeLayer(a),this.options.dataset.toPoint.showAlways||this.addLayer(a.marker),c.push(a))},this),b=0;ba.zoomThreshold&&(this.options.dataset.toPoint.showAlways||this.removeLayer(a.marker),this.addLayer(a),this.removedPaths.splice(b,1),b-=1);this.removedPaths=this.removedPaths.concat(c)}},_getCenter:function(a){if("undefined"!=typeof turf){var b=turf.pointOnSurface(a.toGeoJSON());return L.latLng(b.geometry.coordinates.reverse())}return a.getBounds().getCenter()},_layeradd:function(a){var b=a.layer;if("Point"===b.feature.geometry.type||b.isMarker||(b.setStyle(KR.Style.getPathStyle(b.feature)),b.bringToBack()),this.options.dataset.toPoint){if(b.isMarker)return;if(b.getBounds&&!b.zoomThreshold&&!b.marker){var c=this.getZoomThreshold(b),d=this._pointToLayer(b.feature,this._getCenter(b));d.feature=b.feature,d.on("click",function(a){b.fire("click",{containerPoint:a.containerPoint,latlng:a.latlng,layerPoint:a.layerPoint,originalEvent:a.originalEvent,target:a.target,type:a.type,parent:!0})}),b.zoomThreshold=c,this.removedPaths.push(b),b.marker=d,b.marker.isMarker=!0,b.marker.getParent=function(){return b},this._map.getZoom()<=c&&(this.removeLayer(b),this.options.dataset.toPoint.showAlways||this.addLayer(b.marker)),this.options.dataset.toPoint.showAlways&&this.addLayer(b.marker)}}},setMap:function(a){a.on("layerSelected",this._deselectAll,this)},onAdd:function(a){L.GeoJSON.prototype.onAdd.apply(this,arguments),this.options.dataset&&this.options.dataset.toPoint&&(this._zoomend(),a.on("zoomend",this._zoomend,this),this.on("layeradd",this._layeradd,this)),this.setMap(a)},_createFeatureIcon:function(a,b){return KR.Style.getIcon(a,b)},_pointToLayer:function(a,b){return KR.Style.getMarker(a,b)}}),L.Knreise.geoJson=function(a,b){return new L.Knreise.GeoJSON(a,b)},L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{},L.Knreise.Control.Sidebar=L.Control.Sidebar.extend({initialize:function(a,b){b=b||{},b.autoPan=!1,L.setOptions(this,b);var c=L.DomUtil.get(a);L.DomEvent.on(c,"click",function(a){L.DomEvent.stopPropagation(a)}),c.parentNode.removeChild(c);var d=L.DomUtil.create("div","top-menu",c);this._contentContainer=L.DomUtil.create("div","sidebar-content",c),this.on("hide",this._removeContent,this);var e="leaflet-",f=this._container=L.DomUtil.create("div",e+"sidebar knreise-sidebar "+this.options.position);if(this.options.closeButton){var g=this._closeButton=L.DomUtil.create("a","close pull-right",d);g.innerHTML="×"}this._top=L.DomUtil.create("span","",d),L.DomUtil.addClass(c,e+"control"),f.appendChild(c),this.on("hide",function(){this._map&&(this._map.fire("layerSelected"),this._map.fire("layerDeselect"))},this),this.sidebar=new KR.SidebarContent(this._container,this._contentContainer,this._top,this.options,this._map)},addTo:function(a){return this.sidebar.setMap(a),L.Control.Sidebar.prototype.addTo.apply(this,arguments)},showFeature:function(a,b,c,d,e,f){if(this.show(),this.sidebar.showFeature(a,b,c,d,e,f),KR.UrlFunctions){var g=$("
"),h={id:a.id,url:KR.UrlFunctions.getFeatureLink(a),provider:a.properties.provider};a.properties.feedbackForm&&($(this._contentContainer).append(g),KR.ResponseForm(g,h)),a.id&&this.options.featureHash&&KR.UrlFunctions.setFeatureHash(a.id)}},showFeatures:function(a,b,c,d,e){this.show(),this.sidebar.showFeatures(a,b,c,d,e)},_removeContent:function(){$(this.getContainer()).html(""),KR.UrlFunctions&&KR.UrlFunctions.setFeatureHash()}}),L.Knreise.Control.sidebar=function(a,b){return new L.Knreise.Control.Sidebar(a,b)};var KR=this.KR||{};KR.UrlFunctions={},function(a){"use strict";a.setupLocationUrl=function(a){var b=function(){var b=a.getCenter(),c=KR.Util.getPositionHash(b.lat,b.lng,a.getZoom()),d=window.location.hash.split(":");if(d.length>1){var e=_.rest(d).join(":");c+=":"+e}window.location.hash=c};a.on("moveend",b),b()},a.getLocationUrl=function(){var a=window.location.hash;if(a&&""!==a&&1!==a.indexOf(":")){var b=a.replace("#","").split("/"),c=parseInt(b[0],10),d=parseFloat(b[1]),e=parseFloat(b[2]);return{lat:d,lon:e,zoom:c}}},a.getHashFeature=function(){var a=window.location.hash.split(":");return a.length>1?_.rest(a).join(":"):void 0},a.setFeatureHash=function(a){var b=window.location.hash.split(":")[0];a?window.location.hash=b+":"+encodeURIComponent(a):window.location.hash=b},a.getFeatureLink=function(a){var b=window.location.href.replace(window.location.hash,""),c=a.geometry.coordinates,d=KR.Util.getPositionHash(c[1],c[0],16),e=b+d;return a.id&&(e=e+":"+encodeURIComponent(a.id)),e}}(KR.UrlFunctions);var KR=this.KR||{};KR.MediaCarousel={},function(a){"use strict";function b(a,b){b=b||0;var c=function(){return a-1>b},d=function(){return b>0};return{prev:function(){return d()?--b:b},next:function(){return c()?++b:b},hasNext:c,hasPrev:d}}function c(a){return $('')}function d(a){return-1!==a.indexOf("mp4")?$(''):$('')}function e(a){return $('')}function f(a){if(_.has(h,a.type)){var b=h[a.type](a.url);return b.attr("data-type",a.type),b.attr("data-created",!0),b}}function g(a,b){return $('').attr("data-src",a).attr("data-type",b)}var h={image:c,video:d,sound:e};a.SetupMediaCarousel=function(a){function c(b){d=a.find(".media-list").children();var c=$(d[b]);if(d.addClass("hidden"),c.attr("data-created")||c.hasClass("audiojs"))c.removeClass("hidden");else{var g={type:c.attr("data-type"),url:c.attr("data-src")},h=f(g);c.replaceWith(h),h.is("audio")&&audiojs.create(h)}e.hasPrev()?a.find(".prev").addClass("active"):a.find(".prev").removeClass("active"),e.hasNext()?a.find(".next").addClass("active"):a.find(".next").removeClass("active")}var d=a.find(".media-list").children(),e=new b(d.length);a.find(".next").on("click",function(){e.hasNext()&&c(e.next())}),a.find(".prev").on("click",function(){e.hasPrev()&&c(e.prev())})},a.CreateMediaListMarkup=function(a){var b=$('
'),c=$('
');return c.append(_.map(a,function(a,b){var c=0===b;return c?f(a):g(a.url,a.type)})),b.append(c),a.length>1&&b.append($('
')),b[0].outerHTML}}(KR.MediaCarousel);var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=null;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}(),function(){"use strict";L.Knreise=L.Knreise||{},L.Knreise.Control=L.Knreise.Control||{};var a=function(a,b){function c(c){var d=document.createElement("i");return d.className="layericon fa",a.visible?d.className+=" fa-check-square-o":d.className+=" fa-square-o",c&&(d.className+=" "+c),b.isLoading&&(d.className="layericon fa fa-spinner fa-pulse"),b.enabled?d.style.color=KR.Style.colorForDataset(a,!0,!0):d.style.color="#ddd",d}function d(){var a=c();j.replaceChild(a,k),k=a}function e(){a.visible=!a.visible,d(),a.visible?b.fire("show"):b.fire("hide")}function f(a){m?m.setAttribute("title",m.getAttribute("title")+", "+KR.parseError(a)):(m=L.DomUtil.create("i","error-icon fa fa-exclamation-triangle"),m.setAttribute("title",KR.parseError(a)),j.insertBefore(m,j.childNodes[0]))}function g(){j=document.createElement("label"),_.isUndefined(a.visible)&&(a.visible=!0);var d=document.createElement("span");d.innerHTML=" "+a.name,k=c(),j.appendChild(k),j.appendChild(d),b.error&&f(b.error),b.enabled||(j.className="disabled"),L.DomEvent.on(j,"click",function(){var a=b.enabled&&!b.isLoading;a&&e()})}function h(){b.enabled!==l&&(l=b.enabled,d(),l?j.className=j.className.replace("disabled",""):j.className+="disabled")}function i(){return j}var j,k,l=b.enabled,m=null;return g(),b.on("changeEnabled",h),b.on("dataloadstart",function(){m&&(j.removeChild(m),m=null),d()}),b.on("dataloadend",d),b.on("error",f),{getLabel:i,hasError:function(){return!!b.error}}};L.Control.Datasets=L.Control.extend({initialize:function(a,b){L.setOptions(this,b),this._labels=[],this._handlingClick=!1,this.expanded=!1,this.numLoading=0;var c;for(c in a)a.hasOwnProperty(c)&&this._addLayer(a[c])},_addLayer:function(a){var b,c=a.options.dataset;if(c.datasets)if(c.grouped)this._addDataset(c,a);else for(b=0;b0?this._btnIcon=L.DomUtil.create("i","fa fa-spinner fa-pulse",b):this._btnIcon=L.DomUtil.create("i","fa fa-bars",b),this._container.appendChild(this._closeDiv),this._listContainer=L.DomUtil.create("div",a+" hidden"),this._listContainer.appendChild(this._form),this._container.appendChild(this._listContainer)},_toggle:function(){this.expanded?this._collapse():this._expand()},_expand:function(){L.DomUtil.addClass(this._listContainer,"leaflet-control-layers-expanded"),this.expanded=!0,this._listContainer.className=this._listContainer.className.replace(" hidden","")},_collapse:function(){this._listContainer.className=this._listContainer.className.replace(" leaflet-control-layers-expanded",""),L.DomUtil.addClass(this._listContainer,"hidden"),this.expanded=!1}}),L.control.datasets=function(a,b){return new L.Control.Datasets(a,b)}}(),L.Knreise=L.Knreise||{},L.Knreise.Icon=L.KNreiseMarkers.Icon.extend({options:{icon:null}}),L.Knreise.icon=function(a){return new L.Knreise.Icon(a)};var KR=this.KR||{};KR.DatasetLoader=function(a,b,c,d,e,f){"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider), -_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b;b++)a[b]={identifier:""+b,topLeftCorner:new L.LatLng(20037508.3428,-20037508.3428)};return a}}),L.tileLayer.wmts=function(a,b){return new L.TileLayer.WMTS(a,b)},function(a){"use strict";function b(a){var b,c=new Array(30);for(b=0;22>b;b++)c[b]={identifier:a+":"+b,topLeftCorner:new L.LatLng(20037508,-20037508.34)};return c}a.SKTokenUrl="http://localhost:8001/html/baat/?type=token",a.getNibLayer=function(c,d){a.Util.sendRequest(KR.SKTokenUrl,null,function(a){var e;if(d)e=L.tileLayer.wms("http://gatekeeper2.geonorge.no/BaatGatekeeper/gk/gk.nibcache",{layers:"NiB",format:"image/jpeg",transparent:!1,attribution:"Kartverket"});else{var f="http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts",g="EPSG:900913";e=new L.TileLayer.WMTS(f,{layer:"NiB",style:"normal",tilematrixSet:g,matrixIds:b(g),format:"image/jpeg",attribution:"Kartverket"})}e.setParams({GKT:a}),c(e)})}}(KR);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getKulturminneFunctions=function(a){var b=[],c=function(c,d,e){if(e){var f=_.map(e,function(a){return a.properties.id}),g=_.filter(f,function(a){return-1===b.indexOf(a)});if(b=b.concat(g),g.length){var h={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:g};a.getData(h,function(a){d.extraFeatures.addData(a)})}}},d=function(b,c,d){var e=!0;_.has(c,"showEnkeltminner")&&(e=c.showEnkeltminner);var f,g;if(e){_.has(c,"enkeltminner")||(c.enkeltminner={});var h=c.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,d){a.properties.provider=c.enkeltminner.provider||"Enkeltminne",a.properties.color=c.enkeltminner.sidebarColor||"#B942D0",d.on("click",function(){b.sidebar&&b.sidebar.showFeature(a,c.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))})},style:function(a){return h}}).addTo(b),g=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.lok};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}}c.extraFeatures=L.geoJson(null,{onEachFeature:function(a,b){c.extras&&c.extras.groupId?b.setStyle(KR.Style.getPathStyleForGroup(c.extras.groupId)):(a.properties.datasetId=c.id,b.setStyle(KR.Style.getPathStyle(a,!0))),b.on("click",function(){g&&g(a);var b=_.find(c.geoJSONLayer.getLayers(),function(b){return b.feature.properties.id===a.properties.lok});b&&b.fire("click")})}}).addTo(b),b.on("zoomend",function(){var a=!(b.getZoom()<13);a?b.hasLayer(c.extraFeatures)||b.addLayer(c.extraFeatures):b.hasLayer(c.extraFeatures)&&b.removeLayer(c.extraFeatures)}),d.on("hide",function(){b.removeLayer(c.extraFeatures),f&&b.removeLayer(f)}),d.on("show",function(){b.addLayer(c.extraFeatures),f&&b.addLayer(f)})};return{loadKulturminnePoly:c,initKulturminnePoly:d}},a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid},c)},toPoint:{showAlways:!0,stopPolyClick:!0,minSize:20},minZoom:10,cluster:!1,description:"Nasjonalparker og andre naturvernområder - ca. 2700 i hele landet."},artobs:{name:"Artsobservasjoner",hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"Artsdatabanken"},cluster:!1,description:"Artsobservasjoner fra Artsdatabanken",template:KR.Util.getDatasetTemplate("popup")},folketelling:{name:"Folketelling 1910",provider:"Folketelling 1910",dataset:{api:"folketelling",dataset:"property"},isStatic:!1,minZoom:14,template:KR.Util.getDatasetTemplate("folketelling"),getFeatureData:function(a,c){b.getData({api:"folketelling",type:"propertyData",propertyId:a.properties.efid},function(b){a.properties=b.properties,a.properties.provider="Folketelling 1910",c(a)})},mappings:{title:"gaardsnavn_gateadr"},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk"},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};KR.SplashScreen=function(a,b,c,d,e,f){"use strict";function g(){return window.location.href.replace(window.location.hash,"")}function h(){var a=g(),b="remember_"+a+"=",c=document.cookie.split("; "),d=_.find(c,function(a){return 0===a.indexOf(b)});return d?"true"===d.substring(b.length,d.length):void 0}function i(a){document.cookie="remember_"+g()+"="+a}function j(){this._gray&&this._container.removeChild(this._gray),L.Control.Sidebar.prototype.hide.apply(this,arguments)}function k(){this._gray=L.DomUtil.create("div","gray",this._container),L.Control.Sidebar.prototype.show.apply(this,arguments)}function l(){var g=L.DomUtil.create("div","",document.body);g.id="splashscreen";var h=L.control.sidebar("splashscreen",{position:"center",autoPan:!1});h.hide=_.bind(j,h),h.show=_.bind(k,h),a.addControl(h);var i=_.template($("#splashscreen_template").html()),l=$("
"+i({title:b,image:d,description:c,creator:e,spinner:!!f})+"
");return KR.Util.isInIframe()&&l.find("a").attr("target","_blank"),h.setContent(l.html()),h}function m(a){function b(){i(c.prop("checked"))}var c=$(a.getContainer()).find("#persist_splash_cb");c.prop("checked",h()),c.on("change",b),b()}function n(b){return L.easyButton(a,b,{position:"topright",icon:"fa-info-circle",title:"Om"})}var o=l();n(function(){o.isVisible()?o.hide():o.show()});var p=h();return p||(_.isUndefined(p)&&i(!0),o.show()),m(o),{finishedLoading:function(){var a=$(o.getContainer()).find("#splash_spinner");a&&a.remove()}}};var KR=this.KR||{};KR.ResponseForm=function(a,b){function c(a,b){var c=_.reduce(a,function(a,b,c){return a[g[c]]=b,a},{});$.ajax({url:h,data:c,type:"POST",dataType:"xml",success:b,error:b})}function d(b){a.find("form").addClass("hidden"),a.find("#form-success").removeClass("hidden").find(".media-body").text("Din melding er sendt til "+b+". De vil ta kontakt hvis de har behov for ytterligere informasjon")}function e(e){e.preventDefault();var f=a.find("#form_email").val(),g=a.find("#form_message").val();if(""===f||""===g)return!1;var h=_.extend({},b,{email:f,message:g});return c(h,function(){d(h.provider)}),!1}function f(){a.find("#form_email").val(""),a.find("#form_message").val(""),a.find("#form-success").addClass("hidden"),a.find("form").addClass("hidden"),a.find(".show-more").removeClass("hidden")}var g={message:"entry.126368279",email:"entry.748218122",id:"entry.2043404140",url:"entry.243673559",provider:"entry.826324496"},h="https://docs.google.com/forms/d/1ah66lattC8it7OTIM6de20NSNkBeiQ0vabpsHSaPU7s/formResponse",i=$("#response_form_template").html();a.append(i),a.find("form").on("submit",e),a.find(".show-more").click(function(){a.find(".show-more").addClass("hidden"),a.find("form").removeClass("hidden")}),a.find(".close ").click(f)};var KR=this.KR||{};!function(a){"use strict";function b(a){return function(b){if(!b||!b.features.length)return b;if(-1===b.features[0].geometry.type.indexOf("Polygon"))return turf.within(b,a);var c=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(c)}}function c(a,b,c,d,e){return c&&(b=KR.Config.getDatasets(b,a,d,e)),b}function d(a,b){var c={stroke:!1,fillColor:"#ddd",fillOpacity:.8},d=_.reduce(b.features,function(a,b){return turf.erase(a,b)},KR.Util.WORLD);L.geoJson(d,c).addTo(a)}function e(a,c,e,f,g,h,i,j){if(a.geomFilter){var k={api:"cartodb"};k[h]=g,c.getData(k,function(c){a.showGeom&&d(a.map,c);var f=L.geoJson(c),g=b(c);i(f.getBounds(),e,g,null,j)})}else f(g,function(a){var b=L.latLngBounds.fromBBoxString(a);i(b,e,null,null,j)})}function f(a,b,d,f,g,h){d=c(b,d,f,a.komm),_.isString(a.komm)&&(a.komm=a.komm.split(",")),e(a,b,d,b.getMunicipalityBounds,a.komm,"municipality",g,h)}function g(a,b,d,f,g,h){d=c(b,d,f,null,a.fylke),_.isString(a.fylke)&&(a.fylke=a.fylke.split(",")),e(a,b,d,b.getCountyBounds,a.fylke,"county",g,h)}function h(a,b,d,e,f,g){d=c(b,d,e);var h=L.latLngBounds.fromBBoxString(a.bbox);f(h,d,null,null,g)}function i(a){var b=[];return _.each(a.features,function(a){"GeometryCollection"===a.geometry.type?_.each(a.geometry.geometries,function(c){b.push(KR.Util.createGeoJSONFeatureFromGeom(c,a.properties))}):b.push(a)}),KR.Util.createFeatureCollection(b)}function j(a){var b=_.map(a.features,function(a){return turf.simplify(a,.01,!1)});return KR.Util.createFeatureCollection(b)}function k(a,d,e,f,g,h,k){var l={};e.linecolor&&(l.color=e.linecolor);var m=L.geoJson(a,l),n=m.getBounds();f=c(d,f,g);var o;if(a&&e.buffer){a=i(a),a.features.length>5&&(a=j(a));var p=turf.buffer(a,e.buffer,"kilometers");o=b(p)}h(n,f,o,m,k)}function l(a,b,c,d,e,f){KR.Util.getLine(b,a.line,function(g){k(g,b,a,c,d,e,f)})}function m(a){var b=KR.UrlFunctions.getHashFeature();if(b){var c=function(a){return decodeURIComponent(a.feature.id)===decodeURIComponent(b)||a.feature.id===decodeURIComponent(b)},d=_.find(_.flatten(a),function(a){return _.find(a.getLayers(),c)});if(d){var e=_.find(d.getLayers(),c);e.fire("click"),d.setLayerSelected(e)}}}function n(a,b){return _.map(a,function(a){return a.isStatic&&(a.fixedBbox=b),a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic&&(a.fixedBbox=b),a})),a})}function o(a){return _.map(a,function(a){return a.isStatic=!0,a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic=!0,a})),a})}var p={geomFilter:!1,showGeom:!1,loactionHash:!0,featureHash:!0};a.setupMap=function(a,b,c,d){function e(a,b,d,e,f){c.allstatic&&(b=o(b)),b=n(b,a.toBBoxString());var g=L.Knreise.LocateButton(null,null,{bounds:a});g.addTo(i);var h=function(f){f?(i.setView([f.lat,f.lon],f.zoom),a=i.getBounds()):i.fitBounds(a),c.loactionHash&&KR.UrlFunctions.setupLocationUrl(i);var g,h=function(a){m(a),q&&q.finishedLoading()};c.geomFilter&&a&&(g=a.toBBoxString());var j=k.loadDatasets(b,a.toBBoxString(),d,h,g);e&&e.addTo(i),b.length>1&&L.control.datasets(j).addTo(i)};c.initUserPos?(i.addOneTimeEventListener("locationChange",function(){var a={lat:i.userPosition.lat,lon:i.userPosition.lng,zoom:16};h(a)}),i.addOneTimeEventListener("locationError",function(){h(f)}),g.getLocation()):h(f)}c=c||{},c=_.extend({},p,c);var i=KR.Util.createMap("map",c),j=KR.Util.setupSidebar(i,{featureHash:c.featureHash}),k=new KR.DatasetLoader(a,i,j,null,c.cluster,c.clusterRadius);i.sidebar=j;var q;c.title&&(q=KR.SplashScreen(i,c.title,c.description,c.image,null,!1));var r,s=KR.UrlFunctions.getLocationUrl(i);return c.initUserPos||(r=s),c.map=i,c.komm?f(c,a,b,d,e,r):c.fylke?g(c,a,b,d,e,r):c.line?l(c,a,b,d,e,r):c.bbox?h(c,a,b,d,e,r):alert("Missing parameters!"),i},a.setupMapFromUrl=function(b,c,d){a.setupMap(b,c,d,!0)}}(KR);var KR=this.KR||{};KR.setupCollectionMap=function(a,b,c){"use strict";function d(a){var b=KR.Util.createMap("map",{layer:c});KR.SplashScreen(b,a.title,a.description,a.image,a.creator),$("title").append(a.title);var d=L.latLngBounds.fromBBoxArray(turf.extent(a.geo_json));_.each(a.geo_json.features,function(a){a.properties.datasetId=a.properties.provider,_.has(e,a.properties.provider)&&(a.template=e[a.properties.provider])});var f=KR.Util.setupSidebar(b),g=KR.Util.clusterClick(f),h=KR.Util.featureClick(f);L.Knreise.LocateButton(null,null,{bounds:d}).addTo(b),b.fitBounds(d);var i=L.Knreise.geoJson(a.geo_json,{onEachFeature:function(a,b){h(a,b)}}),j=(new L.Knreise.MarkerClusterGroup).addTo(b);j.addLayers(i.getLayers()),g(j)}var e={"Digitalt fortalt":KR.Util.getDatasetTemplate("digitalt_fortalt"),DigitaltMuseum:KR.Util.getDatasetTemplate("digitalt_museum"),Musit:KR.Util.getDatasetTemplate("musit"),Artsdatabanken:KR.Util.getDatasetTemplate("popup")};a.getCollection(b,d)}; \ No newline at end of file +_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()b;b++)a[b]={identifier:""+b,topLeftCorner:new L.LatLng(20037508.3428,-20037508.3428)};return a}}),L.tileLayer.wmts=function(a,b){return new L.TileLayer.WMTS(a,b)},function(a){"use strict";function b(a){var b,c=new Array(30);for(b=0;22>b;b++)c[b]={identifier:a+":"+b,topLeftCorner:new L.LatLng(20037508,-20037508.34)};return c}a.SKTokenUrl="http://localhost:8001/html/baat/?type=token",a.getNibLayer=function(c,d){a.Util.sendRequest(KR.SKTokenUrl,null,function(a){var e;if(d)e=L.tileLayer.wms("http://gatekeeper2.geonorge.no/BaatGatekeeper/gk/gk.nibcache",{layers:"NiB",format:"image/jpeg",transparent:!1,attribution:"Kartverket"});else{var f="http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts",g="EPSG:900913";e=new L.TileLayer.WMTS(f,{layer:"NiB",style:"normal",tilematrixSet:g,matrixIds:b(g),format:"image/jpeg",attribution:"Kartverket"})}e.setParams({GKT:a}),c(e)})}}(KR);var KR=this.KR||{};KR.Config=KR.Config||{},function(a){"use strict";a.getKulturminneFunctions=function(a){var b=[],c=function(c,d,e){if(e){var f=_.map(e,function(a){return a.properties.id}),g=_.filter(f,function(a){return-1===b.indexOf(a)});if(b=b.concat(g),g.length){var h={api:"kulturminnedataSparql",type:"lokalitetpoly",lokalitet:g};a.getData(h,function(a){d.extraFeatures.addData(a)})}}},d=function(b,c,d){var e=!0;_.has(c,"showEnkeltminner")&&(e=c.showEnkeltminner);var f,g;if(e){_.has(c,"enkeltminner")||(c.enkeltminner={});var h=c.enkeltminner.style||{color:"#fff",weight:1,fillColor:"#B942D0"};f=L.geoJson(null,{onEachFeature:function(a,d){a.properties.provider=c.enkeltminner.provider||"Enkeltminne",a.properties.color=c.enkeltminner.sidebarColor||"#B942D0",d.on("click",function(){b.sidebar&&b.sidebar.showFeature(a,c.enkeltminner.template||KR.Util.getDatasetTemplate("ra_enkeltminne"))})},style:function(a){return h}}).addTo(b),g=function(b){var c={api:"kulturminnedataSparql",type:"enkeltminner",lokalitet:b.properties.lok};a.getData(c,function(a){f.clearLayers(),f.addData(a)})}}c.extraFeatures=L.geoJson(null,{onEachFeature:function(a,b){c.extras&&c.extras.groupId?b.setStyle(KR.Style.getPathStyleForGroup(c.extras.groupId)):(a.properties.datasetId=c.id,b.setStyle(KR.Style.getPathStyle(a,!0))),b.on("click",function(){g&&g(a);var b=_.find(c.geoJSONLayer.getLayers(),function(b){return b.feature.properties.id===a.properties.lok});b&&b.fire("click")})}}).addTo(b),b.on("zoomend",function(){var a=!(b.getZoom()<13);a?b.hasLayer(c.extraFeatures)||b.addLayer(c.extraFeatures):b.hasLayer(c.extraFeatures)&&b.removeLayer(c.extraFeatures)}),d.on("hide",function(){b.removeLayer(c.extraFeatures),f&&b.removeLayer(f)}),d.on("show",function(){b.addLayer(c.extraFeatures),f&&b.addLayer(f)})};return{loadKulturminnePoly:c,initKulturminnePoly:d}},a.getDatasetList=function(b,c,d){var e=a.getKulturminneFunctions(b);c&&3===c.length&&(c="0"+c);var f={difo:{name:"Digitalt fortalt",dataset:{dataset:"difo",api:"norvegiana"},cluster:!0,template:KR.Util.getDatasetTemplate("digitalt_fortalt"),noListThreshold:1/0,description:"Kulturrådets tjeneste for personlige fortellinger fra kulturinstitusjoner og privatpersoner.",allowTopic:!0,feedbackForm:!0,isStatic:!1},verneomr:{id:"verneomraader",dataset:{api:"cartodb",table:"naturvernomrader_utm33_2",columns:["iid","omradenavn","vernef_id","verneform"]},provider:"Naturbase",name:"Verneområder",template:KR.Util.getDatasetTemplate("verneomraader"),getFeatureData:function(a,c){b.getItem({api:"norvegiana",id:"kulturnett_Naturbase_"+a.properties.iid},c)},toPoint:{showAlways:!0,stopPolyClick:!0,minSize:20},minZoom:10,cluster:!1,description:"Nasjonalparker og andre naturvernområder - ca. 2700 i hele landet."},artobs:{name:"Artsobservasjoner",hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"Artsdatabanken"},cluster:!1,description:"Artsobservasjoner fra Artsdatabanken",template:KR.Util.getDatasetTemplate("popup")},folketelling:{name:"Folketelling 1910",provider:"Folketelling 1910",dataset:{api:"folketelling",dataset:"property"},isStatic:!1,minZoom:14,template:KR.Util.getDatasetTemplate("folketelling"),getFeatureData:function(a,c){b.getData({api:"folketelling",type:"propertyData",propertyId:a.properties.efid},function(b){a.properties=b.properties,a.properties.provider="Folketelling 1910",c(a)})},mappings:{title:"gaardsnavn_gateadr"},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk",showEnkeltminner:!1},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};KR.SplashScreen=function(a,b,c,d,e,f){"use strict";function g(){return window.location.href.replace(window.location.hash,"")}function h(){var a=g(),b="remember_"+a+"=",c=document.cookie.split("; "),d=_.find(c,function(a){return 0===a.indexOf(b)});return d?"true"===d.substring(b.length,d.length):void 0}function i(a){document.cookie="remember_"+g()+"="+a}function j(){this._gray&&this._container.removeChild(this._gray),L.Control.Sidebar.prototype.hide.apply(this,arguments)}function k(){this._gray=L.DomUtil.create("div","gray",this._container),L.Control.Sidebar.prototype.show.apply(this,arguments)}function l(){var g=L.DomUtil.create("div","",document.body);g.id="splashscreen";var h=L.control.sidebar("splashscreen",{position:"center",autoPan:!1});h.hide=_.bind(j,h),h.show=_.bind(k,h),a.addControl(h);var i=_.template($("#splashscreen_template").html()),l=$("
"+i({title:b,image:d,description:c,creator:e,spinner:!!f})+"
");return KR.Util.isInIframe()&&l.find("a").attr("target","_blank"),h.setContent(l.html()),h}function m(a){function b(){i(c.prop("checked"))}var c=$(a.getContainer()).find("#persist_splash_cb");c.prop("checked",h()),c.on("change",b),b()}function n(b){return L.easyButton(a,b,{position:"topright",icon:"fa-info-circle",title:"Om"})}var o=l();n(function(){o.isVisible()?o.hide():o.show()});var p=h();return p||(_.isUndefined(p)&&i(!0),o.show()),m(o),{finishedLoading:function(){var a=$(o.getContainer()).find("#splash_spinner");a&&a.remove()}}};var KR=this.KR||{};KR.ResponseForm=function(a,b){function c(a,b){var c=_.reduce(a,function(a,b,c){return a[g[c]]=b,a},{});$.ajax({url:h,data:c,type:"POST",dataType:"xml",success:b,error:b})}function d(b){a.find("form").addClass("hidden"),a.find("#form-success").removeClass("hidden").find(".media-body").text("Din melding er sendt til "+b+". De vil ta kontakt hvis de har behov for ytterligere informasjon")}function e(e){e.preventDefault();var f=a.find("#form_email").val(),g=a.find("#form_message").val();if(""===f||""===g)return!1;var h=_.extend({},b,{email:f,message:g});return c(h,function(){d(h.provider)}),!1}function f(){a.find("#form_email").val(""),a.find("#form_message").val(""),a.find("#form-success").addClass("hidden"),a.find("form").addClass("hidden"),a.find(".show-more").removeClass("hidden")}var g={message:"entry.126368279",email:"entry.748218122",id:"entry.2043404140",url:"entry.243673559",provider:"entry.826324496"},h="https://docs.google.com/forms/d/1ah66lattC8it7OTIM6de20NSNkBeiQ0vabpsHSaPU7s/formResponse",i=$("#response_form_template").html();a.append(i),a.find("form").on("submit",e),a.find(".show-more").click(function(){a.find(".show-more").addClass("hidden"),a.find("form").removeClass("hidden")}),a.find(".close ").click(f)};var KR=this.KR||{};!function(a){"use strict";function b(a){return function(b){if(!b||!b.features.length)return b;if(-1===b.features[0].geometry.type.indexOf("Polygon"))return turf.within(b,a);var c=_.filter(b.features,function(b){var c=turf.extent(b),d=turf.bboxPolygon(c);return!!turf.intersect(d,a.features[0])});return KR.Util.createFeatureCollection(c)}}function c(a,b,c,d,e){return c&&(b=KR.Config.getDatasets(b,a,d,e)),b}function d(a,b){var c={stroke:!1,fillColor:"#ddd",fillOpacity:.8},d=_.reduce(b.features,function(a,b){return turf.erase(a,b)},KR.Util.WORLD);L.geoJson(d,c).addTo(a)}function e(a,c,e,f,g,h,i,j){if(a.geomFilter){var k={api:"cartodb"};k[h]=g,c.getData(k,function(c){a.showGeom&&d(a.map,c);var f=L.geoJson(c),g=b(c);i(f.getBounds(),e,g,null,j)})}else f(g,function(a){var b=L.latLngBounds.fromBBoxString(a);i(b,e,null,null,j)})}function f(a,b,d,f,g,h){d=c(b,d,f,a.komm),_.isString(a.komm)&&(a.komm=a.komm.split(",")),e(a,b,d,b.getMunicipalityBounds,a.komm,"municipality",g,h)}function g(a,b,d,f,g,h){d=c(b,d,f,null,a.fylke),_.isString(a.fylke)&&(a.fylke=a.fylke.split(",")),e(a,b,d,b.getCountyBounds,a.fylke,"county",g,h)}function h(a,b,d,e,f,g){d=c(b,d,e);var h=L.latLngBounds.fromBBoxString(a.bbox);f(h,d,null,null,g)}function i(a){var b=[];return _.each(a.features,function(a){"GeometryCollection"===a.geometry.type?_.each(a.geometry.geometries,function(c){b.push(KR.Util.createGeoJSONFeatureFromGeom(c,a.properties))}):b.push(a)}),KR.Util.createFeatureCollection(b)}function j(a){var b=_.map(a.features,function(a){return turf.simplify(a,.01,!1)});return KR.Util.createFeatureCollection(b)}function k(a,d,e,f,g,h,k){var l={};e.linecolor&&(l.color=e.linecolor);var m=L.geoJson(a,l),n=m.getBounds();f=c(d,f,g);var o;if(a&&e.buffer){a=i(a),a.features.length>5&&(a=j(a));var p=turf.buffer(a,e.buffer,"kilometers");o=b(p)}h(n,f,o,m,k)}function l(a,b,c,d,e,f){KR.Util.getLine(b,a.line,function(g){k(g,b,a,c,d,e,f)})}function m(a){var b=KR.UrlFunctions.getHashFeature();if(b){var c=function(a){return decodeURIComponent(a.feature.id)===decodeURIComponent(b)||a.feature.id===decodeURIComponent(b)},d=_.find(_.flatten(a),function(a){return _.find(a.getLayers(),c)});if(d){var e=_.find(d.getLayers(),c);e.fire("click"),d.setLayerSelected(e)}}}function n(a,b){return _.map(a,function(a){return a.isStatic&&(a.fixedBbox=b),a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic&&(a.fixedBbox=b),a})),a})}function o(a){return _.map(a,function(a){return a.isStatic=!0,a.datasets&&(a.datasets=_.map(a.datasets,function(a){return a.isStatic=!0,a})),a})}var p={geomFilter:!1,showGeom:!1,loactionHash:!0,featureHash:!0};a.setupMap=function(a,b,c,d){function e(a,b,d,e,f){c.allstatic&&(b=o(b)),b=n(b,a.toBBoxString());var g=L.Knreise.LocateButton(null,null,{bounds:a});g.addTo(i);var h=function(f){f?(i.setView([f.lat,f.lon],f.zoom),a=i.getBounds()):i.fitBounds(a),c.loactionHash&&KR.UrlFunctions.setupLocationUrl(i);var g,h=function(a){m(a),q&&q.finishedLoading()};c.geomFilter&&a&&(g=a.toBBoxString());var j=k.loadDatasets(b,a.toBBoxString(),d,h,g);e&&e.addTo(i),b.length>1&&L.control.datasets(j).addTo(i)};c.initUserPos?(i.addOneTimeEventListener("locationChange",function(){var a={lat:i.userPosition.lat,lon:i.userPosition.lng,zoom:16};h(a)}),i.addOneTimeEventListener("locationError",function(){h(f)}),g.getLocation()):h(f)}c=c||{},c=_.extend({},p,c);var i=KR.Util.createMap("map",c),j=KR.Util.setupSidebar(i,{featureHash:c.featureHash}),k=new KR.DatasetLoader(a,i,j,null,c.cluster,c.clusterRadius);i.sidebar=j;var q;c.title&&(q=KR.SplashScreen(i,c.title,c.description,c.image,null,!1));var r,s=KR.UrlFunctions.getLocationUrl(i);return c.initUserPos||(r=s),c.map=i,c.komm?f(c,a,b,d,e,r):c.fylke?g(c,a,b,d,e,r):c.line?l(c,a,b,d,e,r):c.bbox?h(c,a,b,d,e,r):alert("Missing parameters!"),i},a.setupMapFromUrl=function(b,c,d){a.setupMap(b,c,d,!0)}}(KR);var KR=this.KR||{};KR.setupCollectionMap=function(a,b,c){"use strict";function d(a){var b=KR.Util.createMap("map",{layer:c});KR.SplashScreen(b,a.title,a.description,a.image,a.creator),$("title").append(a.title);var d=L.latLngBounds.fromBBoxArray(turf.extent(a.geo_json));_.each(a.geo_json.features,function(a){a.properties.datasetId=a.properties.provider,_.has(e,a.properties.provider)&&(a.template=e[a.properties.provider])});var f=KR.Util.setupSidebar(b),g=KR.Util.clusterClick(f),h=KR.Util.featureClick(f);L.Knreise.LocateButton(null,null,{bounds:d}).addTo(b),b.fitBounds(d);var i=L.Knreise.geoJson(a.geo_json,{onEachFeature:function(a,b){h(a,b)}}),j=(new L.Knreise.MarkerClusterGroup).addTo(b);j.addLayers(i.getLayers()),g(j)}var e={"Digitalt fortalt":KR.Util.getDatasetTemplate("digitalt_fortalt"),DigitaltMuseum:KR.Util.getDatasetTemplate("digitalt_museum"),Musit:KR.Util.getDatasetTemplate("musit"),Artsdatabanken:KR.Util.getDatasetTemplate("popup")};a.getCollection(b,d)}; \ No newline at end of file diff --git a/dist/scripts3d.js b/dist/scripts3d.js index 3b24f0b5..31a46ebb 100644 --- a/dist/scripts3d.js +++ b/dist/scripts3d.js @@ -2534,7 +2534,7 @@ KR.Config = KR.Config || {}; color: '#fff', weight: 1, fillColor: '#B942D0' - } + }; enkeltMinneLayer = L.geoJson(null, { onEachFeature: function (feature, layer) { @@ -2954,7 +2954,8 @@ KR.Config = KR.Config || {}; count: 10, callback: kulturminneFunctions.loadKulturminnePoly }, - description: 'Data fra Riksantikvarens kulturminnesøk' + description: 'Data fra Riksantikvarens kulturminnesøk', + showEnkeltminner: false }, 'brukerminner': { name: 'Kulturminnesøk - brukerregistreringer', diff --git a/dist/scripts3d.min.js b/dist/scripts3d.min.js index af6aaa38..6070d325 100644 --- a/dist/scripts3d.min.js +++ b/dist/scripts3d.min.js @@ -1,2 +1,2 @@ var KR=this.KR||{};!function(a){"use strict";a.parseError=function(a){if(a.responseJSON){if(a.responseJSON.error)return a.responseJSON.error.join(", ");if(a.responseJSON.status)return a.responseJSON.status}return a.statusText?a.statusText:a.error?a.error.info?a.error.info:a.error.error?a.error.error:a.error:"Unknown error"},a.errorHandler=function(b){var c=$(b);c.find(".close").on("click",function(){c.find(".content").html(""),c.remove()});var d=_.template("
<%= dataset %>: <%= error %>
");return function(b){var e=d({dataset:b.dataset,error:a.parseError(b.error)});c.parent()?c.find(".content").append(e):c.find(".content").html(e),$("body").append(c)}}}(KR);var KR=this.KR||{};KR.Config={contentIcons:{IMAGE:"camera-retro",VIDEO:"file-video-o",SOUND:"music",TEXT:"file-text","default":"file-o"},templates:{}},KR.Config.ImageCaheUrl="http://egbtmre.cloudimg.io",KR.Util=KR.Util||{},function(a){"use strict";function b(a,b){var c=a.lastIndexOf(b);return-1!==c&&c+b.length===a.length}function c(a){return 1e3>a?"0"+a:a}a.iconForContentType=function(a){var b=a.properties.contentType;return _.has(KR.Config.contentIcons,b)?KR.Config.contentIcons[b]:KR.Config.contentIcons["default"]},a.getDatasetTemplate=function(a){var b=$("#"+a+"_template").html();return b?_.template(b):void 0},a.templateForDataset=function(a){return _.has(KR.Config.templates,a)?KR.Config.templates[a]:void 0},a.createStyleString=function(a){return _.map(a,function(a,b){return b+": "+a}).join(";")},a.colorForProvider=function(a,b){var c=!0;"hex"!==b&&(c=!1);var d={properties:{datasetId:a}};return KR.Style.colorForFeature(d,c,!0)},a.featureClick=function(a){return function(b,c,d){c.on("click",function(c){d&&d.toPoint&&d.toPoint.stopPolyClick&&!c.parent||(d?a.showFeature(b,d.template,d.getFeatureData):a.showFeature(b))})}},a.getTemplateForFeature=function(a,b){if(b){if(b.datasets){var c=_.find(b.datasets,function(b){return b._knreise_id===a.properties.datasetID});return c.template}return b.template}},a.clusterClick=function(b){return function(c,d){c.on("clusterclick",function(c){var e=_.map(c.layer.getAllChildMarkers(),function(b){var c=b.feature;return d&&!c.template&&(c.template=a.getTemplateForFeature(c,d)),c}),f=_.extend({},{template:null,getFeatureData:null,noListThreshold:null},d);b.showFeatures(e,f.template,f.getFeatureData,f.noListThreshold)})}},a.hexToRgba=function(a,b){b=b||1;var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(!c)return 0;var d={r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)};return"rgba("+d.r+","+d.g+","+d.b+","+b+")"},a.filterByBbox=function(a,b){var c=turf.featurecollection([turf.bboxPolygon(KR.Util.splitBbox(b))]);return turf.within(a,c)},a.getDatasetId=function(a){return"norvegiana"===a.dataset.api?a.dataset.dataset:"wikipedia"===a.dataset.api?"wikipedia":a.id?a.id:KR.Util.stamp(a)},"undefined"!=typeof L&&(L.latLngBounds.fromBBoxArray=function(a){return new L.LatLngBounds(new L.LatLng(a[1],a[0]),new L.LatLng(a[3],a[2]))},L.latLngBounds.fromBBoxString=function(a){return L.latLngBounds.fromBBoxArray(KR.Util.splitBbox(a))},L.rectangle.fromBounds=function(a){return L.rectangle([a.getSouthWest(),a.getNorthEast()])}),a.parseQueryString=function(a){var b=decodeURIComponent(a);if(""!==b)return _.reduce(b.replace("?","").split("&"),function(a,b){b=b.split("=");var c=b[1];return"true"===c?c=!0:"false"===c&&(c=!1),a[b[0]]=c,a},{})};var d=_.template("<%= totalt %> (<%= menn %> menn, <%= kvinner %> kvinner)");a.formatPersons=function(a){var b=a.split("-");return b.length<2?a:d({totalt:b[0],menn:b[1],kvinner:b[2]})},a.getBaseLayer=function(a,b){var c={nib:KR.getNibLayer,hist:function(a){a(L.tileLayer.wms("http://wms.geonorge.no/skwms1/wms.historiskekart",{layers:"historiskekart",format:"image/png",attribution:"Kartverket"}))}};if(_.has(c,a))c[a](b);else{var d=navigator.userAgent.indexOf("Safari")>-1,e=!d;b(L.tileLayer.kartverket(a,{useCache:e}))}},a.getLine=function(a,c,d){if(_.isFunction(c))return void c(function(a){d(a)});var e;if(0===c.indexOf("utno/")){var f=c.replace("utno/","");e={api:"utno",id:f,type:"gpx"}}else 0===c.indexOf("http")&&(b(c,"kml")?e={api:"kml",url:c}:b(c,"gpx")||-1!==c.indexOf("http://ut.no/tur/")?e={api:"gpx",url:c}:b(c,"geojson")&&(e={api:"geojson",url:c}));e?a.getData(e,function(a){d(a)}):alert("Kunne ikke laste linjegeometri")},a.messageDisplayer=function(a){return function(b,c){var d=$(a);d.find(".close").on("click",function(){d.find(".content").html(""),d.remove()}),d.addClass("alert-"+b),d.find(".content").html(c),$("body").append(d)}},a.mostlyCoveringMunicipality=function(a,b,c){var d="ST_MakeEnvelope("+b+", 4326)",e="SELECT komm FROM kommuner WHERE ST_Intersects(the_geom, "+d+")ORDER BY st_area(st_intersection(the_geom, "+d+")) DESC LIMIT 1",f={api:"cartodb",query:e,mapper:function(a){return a.rows[0].komm}};a.getData(f,c)},a.sparqlBbox=function(a,b,d,e,f){KR.Util.mostlyCoveringMunicipality(a,d,function(d){b.kommune=c(d),a.getData(b,e,f)})},a.distanceAndSort=function(a,b){var c=_.map(a.features,function(a){return a.properties.distance=turf.distance(b,a),a});return turf.featurecollection(c.sort(function(a,b){return a.properties.distanceb.properties.distance?1:0}))},a.round=function(a,b){_.isUndefined(b)&&(b=2);var c=Math.pow(10,b);return Math.round(a*c)/c};var e=_.template("#<%= zoom %>/<%= lat %>/<%= lon %>");a.getPositionHash=function(b,c,d){return e({zoom:d,lat:a.round(b,4),lon:a.round(c,4)})},a.WORLD={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]]}},a.createMap=function(b,c){c=c||{};var d=L.map(b,{minZoom:c.minZoom||3,maxZoom:c.maxZoom||18,maxBounds:L.geoJson(a.WORLD).getBounds()}),e=c.layer||"norges_grunnkart_graatone";return _.isString(e)?KR.Util.getBaseLayer(e,function(a){a.addTo(d)}):e.addTo(d),d},a.setupSidebar=function(a,b){b=b||{};var c=KR.Util.getDatasetTemplate("popup"),d=_.template($("#list_item_template").html()),e=_.template($("#marker_template").html()),f=_.template($("#thumbnail_template").html()),g=_.template($("#footer_template").html()),h=_.extend({},{position:"left",template:c,listElementTemplate:d,markerTemplate:e,thumbnailTemplate:f,footerTemplate:g},b),i=L.Knreise.Control.sidebar("sidebar",h);return a.addControl(i),i},a.distanceAndBearing=function(a,b){return{distance:1e3*turf.distance(a,b,"kilometers"),bearing:turf.bearing(a,b)}};var f=_.template("<%= service %>/s/crop/<%= width %>x<%= height %>/<%= image %>");a.getImageCache=function(a,b,c){return KR.Config.ImageCaheUrl?f({service:KR.Config.ImageCaheUrl,width:b,height:c,image:a}):a},a.isInIframe=function(){try{return window.self!==window.top}catch(a){return!0}}}(KR.Util);var KR=this.KR||{};KR.Style={},function(a){"use strict";function b(a){var b=a.properties.vernef_id;return _.find(p,function(a){return-1!==a.ids.indexOf(b)})}function c(a){return u[a]||"blue"}function d(a,b,c,d){return _.isFunction(a[b])?d?a[b]():a[b](c):a[b]}function e(a,b,c){return c?d(a,"fillcolor",b,!0):d(a,"fillcolor",b)}function f(a,b){return a.bordercolor?d(a,"bordercolor",b):e(a,b)}function g(b){return a.groups[b]}function h(b){var c;return b.properties&&b.properties.groupId?g(b.properties.groupId):(b.properties&&b.properties.datasetId&&(c=a.getDatasetStyle(b.properties.datasetId)),c?c:_.extend({},s))}function i(a,b,c){return c=c||9,{radius:c,weight:1,opacity:1,color:a,fillColor:b,fillOpacity:.4}}function j(a,b,c){return L.circleMarker(a,i(b,c))}function k(a){return L.Knreise.icon({markerColor:a})}function l(a,b,c){var d="";return a.properties&&a.properties.title&&(d=a.properties.title),L.marker(b,{icon:c,title:d})}function m(a,b,c){if(a.properties&&a.properties.thumbnail){var d={"border-color":b,"background-image":"url("+a.properties.thumbnail+")"};c&&(d["border-width"]="3px");var e=KR.Util.getImageCache(a.properties.thumbnail,50,50),f='
';return new L.DivIcon({className:"leaflet-marker-circle",html:f,iconSize:[50,50],iconAnchor:[25,25]})}}function n(a,b,c){var d=_.filter(a,function(a){return a.feature.properties.thumbnail});if(d.length){var e;_.isArray(b)&&(e=_.rest(b),b=b[0]);var f=KR.Util.getImageCache(d[0].feature.properties.thumbnail,50,50),g={"border-color":b,"background-image":"url("+f+");"};e&&(g["box-shadow"]=_.map(e,function(a,b){var c=2*(b+1);return"0 0 0 "+c+"px "+a}).join(",")+";"),c&&(g["border-width"]="3px");var h='
'+a.length+"";return new L.DivIcon({className:"leaflet-marker-photo",html:h,iconSize:[60,60],iconAnchor:[30,30]})}}function o(a,b){var c=KR.Util.hexToRgba(b,.4);return new L.DivIcon({className:"leaflet-marker-circle",html:'
'+a.length+"",iconSize:[20,20],iconAnchor:[10,10]})}var p={landskapsvern:{ids:["LVO","LVOD","LVOP","LVOPD","BV","MAV","P","GVS","MIV","NM","BVV","PO","DO","D"],style:{fillColor:"#d8cb7a",color:"#9c8f1b"}},nasjonalpark:{ids:["NP","NPS"],style:{fillColor:"#7f9aac",color:"#b3a721"}},naturreservat:{ids:["NR","NRS"],style:{fillColor:"#ef9874",color:"#ef9873"}}},q="#72B026",r="#38A9DC",s={fillcolor:r,circle:!1,thumbnail:!0},t={difo:"Digitalt fortalt",Kulturminnesok:"Kulturminnesok",DiMu:"DigitaltMuseum",MUSIT:"Musit",Artsdatabanken:"Artsdatabanken",wikipedia:"wikipedia",riksantikvaren:"riksantikvaren"};a.datasets={"Digitalt fortalt":{fillcolor:"#F69730",circle:!1,thumbnail:!0},Kulturminnesok:{fillcolor:"#436978",circle:!1,thumbnail:!1},DigitaltMuseum:{fillcolor:"#436978",circle:!1,thumbnail:!1},Musit:{fillcolor:"#436978",circle:!1,thumbnail:!1},Artsdatabanken:{fillcolor:"#5B396B",thumbnail:!1,circle:!0},riksantikvaren:{fillcolor:"#436978",circle:!1,thumbnail:!0},verneomraader:{fillcolor:function(a){if(a){var c=b(a);if(c)return c.style.fillColor}return"#009300"},bordercolor:function(a){if(a){var c=b(a);if(c)return c.style.color}return"#009300"},thumbnail:!1,circle:!0},wikipedia:{fillcolor:"#D14020",thumbnail:!0}},a.groups={},a.getDatasetStyle=function(b){var c=a.datasets[t[b]];return c||(c=a.datasets[b]),c},a.setDatasetStyle=function(b,c){_.has(t,b)||(t[b]=b);var d=a.getDatasetStyle(b);d||(d=s),a.datasets[t[b]]=_.extend({},d,c)};var u={"#F69730":"orange","#38A9DC":"blue","#A23336":"darkred","#72B026":"green","#436978":"cadetblue","#5B396B":"darkpurple","#728224":"darkgreen","#D252B9":"purple","#D14020":"red"};a.getClusterIcon=function(a,b){var c,d=a.getAllChildMarkers(),f=_.uniq(_.map(d,function(a){return a.feature.properties.groupId})),i=h(d[0].feature);if(_.compact(f).length>1){var j=_.compact(f);j.length>1&&(c=_.map(j,_.compose(e,g)))}else c=e(i,d[0].feature);if(b&&(c=q),i.thumbnail){var k=n(d,c,b);if(k)return k}return o(d,c)},a.getIcon=function(a,b){var c=h(a),d=b?q:e(c,a),g=b?q:f(c,a);if(c.thumbnail){var j=m(a,g,b);if(j)return j}return c.circle?i(g,d,c.radius):k(d)},a.getMarker=function(b,c){var d=h(b);if(d.thumbnail){var g=m(b,f(d,b),!1);if(g)return l(b,c,g)}return d.circle?j(c,f(d,b),e(d,b)):l(b,c,a.getIcon(b,!1))},a.colorForFeature=function(a,b,d){var f=h(a);return f?b?e(f,a,d):c(e(f,a)):void 0},a.colorForDataset=function(b,d,f){var g,i;return b.grouped?(g=a.groups[KR.Util.stamp(b)],g||(i=b.datasets[0].extras.datasetId)):(i||(i=b.extras.datasetId),g=h({properties:{datasetId:i}})),g?d?e(g,null,f):c(e(g,null)):void 0},a.getPathStyle=function(a,b){b=b||!1;var c=h(a),d=e(c,a),g=f(c,a);return{weight:1,color:g,fillColor:d,clickable:b,opacity:.8,fillOpacity:.4}},a.getPathStyleForGroup=function(b,c){var d={properties:{groupId:b}};return a.getPathStyle(d,c)}}(KR.Style);var KR=this.KR||{};KR.PathTracer=function(a,b,c){"use strict";function d(b,c){Cesium.Math.setRandomNumberSeed(3),a.clock.startTime=b.clone(),a.clock.stopTime=c.clone(),a.clock.currentTime=b.clone(),a.clock.clockRange=Cesium.ClockRange.LOOP_STOP,a.clock.multiplier=l,a.clock.shouldAnimate=!1}function e(b,c,d){var e=a.entities.add({availability:new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({start:b,stop:c})]),position:d,orientation:new Cesium.VelocityOrientationProperty(d)});return e}function f(a,b,c){b=b.reverse(),c.geometry.coordinates=c.geometry.coordinates.reverse();var d=0,e=turf.point(c.geometry.coordinates[0]),f=new Cesium.SampledPositionProperty;return _.each(b,function(b,g){var h=turf.point(c.geometry.coordinates[g]);d+=1e3*turf.distance(e,h,"kilometers"),e=h;var i=Cesium.JulianDate.addSeconds(a,d/k,new Cesium.JulianDate),j=new Cesium.Cartesian3(b.x,b.y,b.z+2);f.addSample(i,j)}),f}function g(b){a.clock.onTick.addEventListener(function(c){if(m){var d=Cesium.Cartesian3,e=b.position.getValue(c.currentTime,new d),f=b.position.getValue(Cesium.JulianDate.addSeconds(c.currentTime,1/60,new Cesium.JulianDate),new d),g=d.subtract(f,e,new d);d.normalize(g,g);var h=new d,i=new d,j=new d;Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(e,h),d.cross({x:0,y:0,z:1},h,i),d.cross(h,i,j);var k=new d;k.x=d.dot(g,i),k.y=d.dot(g,j),k.z=d.dot(g,h);var l=new d(0,0,1),o=new d(1,0,0),p=new d(0,1,0),q=d.dot(k,o),r=d.dot(k,p),s=d.dot(k,l),t=Math.atan2(q,r),u=Math.asin(s);t+=0*Math.PI,u+=-20/180*Math.PI;var v=800,w=new Cesium.HeadingPitchRange(t,u+n,v);a.scene.camera.lookAt(b.position.getValue(c.currentTime),w)}})}function h(){var h=c.features[0],i=1e3*turf.lineDistance(h,"kilometers"),j=i/k,l=Cesium.JulianDate.fromDate(new Date(2015,2,25,16)),m=Cesium.JulianDate.addSeconds(l,j,new Cesium.JulianDate);d(l,m);var n=f(l,b,h),o=e(l,m,n);o.position.setInterpolationOptions({interpolationDegree:5,interpolationAlgorithm:Cesium.LagrangePolynomialApproximation}),a.trackedEntity=void 0,g(o)}function i(){m=!0,a.clock.shouldAnimate=!0}function j(){m=!1,a.clock.shouldAnimate=!1}var k=1.4,l=35,m=!1,n=0;return h(),{start:i,stop:j,isRunning:function(){return m},setPitchCorr:function(a){n=a}}};var KR=this.KR||{};KR.CesiumMap=function(a,b,c){"use strict";function d(a){return a=a||"//assets.agi.com/stk-terrain/world",new Cesium.CesiumTerrainProvider({url:a,requestVertexNormals:!0,requestWaterMask:!1})}function e(a){var b,c=s.scene.camera;c.moveEnd.addEventListener(function(){var d=Cesium.Ellipsoid.WGS84.cartesianToCartographic(c.position),e=!Cesium.Rectangle.contains(a,d);e&&b&&(c.position=b),b=c.position.clone()})}function f(){s=new Cesium.Viewer(a,t.cesiumViewerOpts);var b=s.scene;b.imageryLayers.removeAll();var f=b.globe;t.cesiumViewerOpts.enableLighting&&(f.enableLighting=!0),f.depthTestAgainstTerrain=!0,s.terrainProvider=d(t.cesiumViewerOpts.terrainUrl);var g,h=b.camera;if(c){c=KR.Util.splitBbox(c);var i=Cesium.Ellipsoid.WGS84;g=new Cesium.Rectangle(Cesium.Math.toRadians(c[0]),Cesium.Math.toRadians(c[1]),Cesium.Math.toRadians(c[2]),Cesium.Math.toRadians(c[3])),h.viewRectangle(g,i)}g&&t.cesiumViewerOpts.limitBounds&&e(g)}function g(a,b){var c=a.features[0].geometry.coordinates,d=_.map(c,function(a){return new Cesium.Cartographic.fromDegrees(a[0],a[1])}),e=Cesium.sampleTerrain(s.terrainProvider,14,d);Cesium.when(e,function(a){b(Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(a))})}function h(a){return _.map(a,function(a,b){return b+"="+a}).join("&")}function i(a){return new Cesium.UrlTemplateImageryProvider({url:a})}function j(a,b,c){var d={SERVICE:"WMTS",REQUEST:"GetTile",TILEROW:"{TileRow}",TILECOL:"{TileCol}",STYLE:"{Style}",LAYER:b};return{url:a+"?"+h(_.extend({},d,c||{})),layer:"",tileMatrixSetID:""}}function k(a,b,c){var d={style:"default",version:"1.0.0",format:"image/png",maximumLevel:19};return new Cesium.WebMapTileServiceImageryProvider(_.extend({},d,j(a,b,c)))}function l(a,b){return new Cesium.WebMapServiceImageryProvider({url:a,layers:b,parameters:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/png",transparent:!0}})}function m(a){return _.map(a,function(a){var b={position:Cesium.Cartesian3.fromDegrees(a.pos.lng,a.pos.lat,a.pos.height||80),billboard:{image:a.icon,show:!0,heightReference:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:1},label:{text:a.text,font:"14pt monospace",style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,32)},properties:a.properties};return s.entities.add(b),b})}function n(a,b,c,d){c=c||14;var e=[];d||(d=0),_.each(a.features,function(a){var b=a.geometry.coordinates;e.push(new Cesium.Cartographic.fromDegrees(b[0],b[1]))});var f=Cesium.sampleTerrain(s.terrainProvider,c,e);Cesium.when(f,function(c){var e=c;_.each(a.features,function(a,b){var c=e[b];a.geometry.coordinates=[Cesium.Math.toDegrees(c.longitude),Cesium.Math.toDegrees(c.latitude),c.height+d]}),b(a)})}function o(a){var b=new Cesium.EntityCollection,c=new Cesium.ScreenSpaceEventHandler(s.scene.canvas);c.setInputAction(function(c){var d=s.scene.drillPick(c.position);if(Cesium.defined(d)){b.removeAll();var e=_.map(d,function(a){var c=a.id;return b.add(c),c.properties});e.length&&a(e)}},Cesium.ScreenSpaceEventType.LEFT_CLICK)}function p(a,b,c,d){c.getBbox(a,b,function(a){n(a,function(a){var b=Cesium.GeoJsonDataSource.load(a);d(b)})},function(a){d()})}function q(a,b,c,d){c.getBbox(a,b,function(a){_.each(a.features,function(a){a.properties=_.extend(a.properties,d)}),n(a,function(a){var b=_.map(a.features,function(a){var b=a.properties["marker-color"]||"blue";return{pos:{lat:a.geometry.coordinates[1],lng:a.geometry.coordinates[0],height:a.geometry.coordinates[2]},icon:"../common/img/markers/"+b+".png",properties:a.properties}});m(b)})},function(b){console.warn("could not load dataset",a)})}function r(){$(".spinner-wrapper").delay(2e3).fadeOut({duration:200})}Cesium.BingMapsApi.defaultKey="";var s,t={cesiumViewerOpts:_.extend({timeline:!1,baseLayerPicker:!1,geocoder:!1,enableLighting:!0,infoBox:!1,animation:!1,orderIndependentTranslucency:!1},b||{})};return f(),{viewer:s,addMarkers:m,build3DLine:g,addClickhandler:o,loadDataset:p,loadDataset2:q,stopLoading:r,getTiles:i,getWmts:k,getWms:l,addImageryProvider:function(a){s.imageryLayers.addImageryProvider(a)}}},KR.CesiumUtils={},KR.CesiumUtils.getBounds=function(a){"use strict";var b=turf.envelope(a),c=b.geometry.coordinates[0];return c[0].concat(c[2]).join(",")};var KR=this.KR||{};KR.CesiumSidebar=function(a,b,c,d){"use strict";function e(a){o.html(a)}function f(a){return{properties:a,template:a.template}}function g(a){p.showFeature(f(a))}function h(a){var b=_.map(a,f);p.showFeatures(b)}function i(b){a.show("slide",{direction:"left"},100),1===b.length?g(b[0]):h(b)}function j(){a.hide("slide",{direction:"left"},100),e(""),q&&q()}d=d||{footerTemplate:_.template($("#footer_template").html()),listElementTemplate:_.template($("#list_item_template").html()),markerTemplate:_.template($("#marker_template").html()),thumbnailTemplate:_.template($("#thumbnail_template").html())};var k=$('');a.append(k);var l=$('
');k.append(l);var m=$('×');l.append(m);var n=$("");l.append(n);var o=$('');k.append(o);var p=new KR.SidebarContent(k,o,n,d),q=c;return a.addClass("knreise-sidebar"),m.click(j),{show:i,addCloseCb:function(a){q=a}}};var KR=this.KR||{};!function(){"use strict";function a(){function a(a){if(d&&d.userPosition){var b=turf.point([d.userPosition.lng,d.userPosition.lat]),c=KR.Util.distanceAndBearing(b,a),e=c.distance;return e=1e3>e?KR.Util.round(e,0)+" Meter":KR.Util.round(e/1e3,2)+" Kilometer",{dist:e,rot:c.bearing-45}}}function b(){if(e&&d&&d.userPosition&&f){g&&g.remove();var b=e.find("h3").eq(0),c=a(f);g=$(h({distanceBearing:c})),b.length?b.after(g):e.prepend(g)}}function c(a,c){e=c,f=a,b()}var d,e,f,g,h=_.template($("#user_position_template").html());return{setMap:function(a){d=a,d.on("locationChange",b)},selectFeature:c}}KR.SidebarContent=function(b,c,d,e){function f(a){c.html(a)}function g(a){a&&c.swipe({swipe:function(){},allowPageScroll:"vertical"}).off("swipeLeft").on("swipeLeft",function(){a.next&&a.next()}).off("swipeRight").on("swipeRight",function(){a.prev&&a.prev()})}function h(a,b,c,d,f,g){var i;b>0&&(i=function(e){e&&e.preventDefault(),b-=1,a=f[b];var i=h(a,b,c,d,f,g);j(a,c,d,i,b,f.length)});var l;return b"),p+='',f(p),void i(a,function(b){b.properties=_.extend(a.properties,b.properties),j(b,h,null,k,n,o)})}h=h||a.template||KR.Util.templateForDataset(a.properties.dataset)||l;var q=a.properties.images;_.isArray(q)&&(q=q[0]),a.properties.images||(a.properties.images=null),a.properties.allProps&&a.properties.allProps.europeana_rights?a.properties.license=a.properties.allProps.europeana_rights[0]:a.properties.license=null;var r=a.properties.color||KR.Style.colorForFeature(a,!0,!0),p=''+a.properties.provider+"";if(p+=h(_.extend({image:null},a.properties)),e.footerTemplate&&a.properties.link&&(p+=e.footerTemplate(a.properties)),p=$(["
",p,"
"].join(" ")),KR.Util.isInIframe()&&p.find("a").attr("target","_blank"),m.selectFeature(a,p),f(p),g(k),b.find(".prev-next-arrows").remove(),d.html(""),k){var s=$('');d.append(s),s.click(k.close);var t=n+1;d.append($('
'+t+" av "+o+"
"));var u=$('');b.append(u),k.prev&&u.click(k.prev).addClass("active");var v=$('');b.append(v),k.next&&v.click(k.next).addClass("active")}var w=c.find(".media-container");w.length&&KR.MediaCarousel.SetupMediaCarousel(w),"undefined"!=typeof audiojs&&audiojs.createAll(),c.scrollTop(0)}function k(a,b,f,g,j){g=void 0===g?e.noListThreshold:g;var k=a.length<=g;if(k&&j!==!0){var l=a[0];c.html("");var m=h(l,0,b,f,a);return void this.showFeature(l,b,f,m,0,a.length)}var n=$(''+a.length+"");d.html(n);var o=_.chain(a).groupBy(function(a){return a.properties.provider}).map(function(c,d){var e=$("
"),g=$('
'),h=_.map(c,function(c){var d=_.findIndex(a,function(a){return a===c});return i(c,d,b,f,a)},this);return g.append(h),e.append('
'+d+"
"),e.append(g),e}).value();c.html(o),c.scrollTop(0)}var l=KR.Util.getDatasetTemplate("popup"),m=new a;return c=$(c),b=$(b),d=$(d),{showFeature:j,showFeatures:k,setMap:function(a){m.setMap(a)}}}}();var KR=this.KR||{};KR.DatasetLoader=function(a,b,c,d,e,f){"use strict";function g(a){var b=KR.Util.stamp(a);return function(c){return c&&c.features.length?(_.each(c.features,function(c){c.properties.datasetID=b,_.has(a,"circle")&&(c.properties.circle=a.circle),_.has(a,"provider")&&(c.properties.provider=a.provider),_.has(a,"extras")&&(c.properties=_.extend(c.properties,a.extras)),c.properties.feedbackForm=a.feedbackForm,_.has(a,"mappings")&&_.each(a.mappings,function(a,b){c.properties[b]=c.properties[a]}),c.template=KR.Util.getTemplateForFeature(c,a)}),c):c}}function h(a){var b=_.reduce(_.without(_.keys(a),"datasets"),function(b,c){return"style"!==c&&(b[c]=a[c]),b},{});if(a.style){b.extras=b.extras||{};var c=KR.Util.stamp(a);b.extras.groupId=c,KR.Style.groups[c]=a.style}return a.datasets=_.map(a.datasets,function(a){return _.extend({},b,a)}),a}function i(a,b){var c={dataset:b,onEachFeature:function(a,c){A&&A(a,c,b)}};return b.style&&(c.style=b.style),L.Knreise.geoJson(a,c)}function j(a,b){a.clearLayers();var c=_.reduce(b,function(a,b){return a.concat(b.toGeoJSON().features)},[]);a.addData(KR.Util.createFeatureCollection(c)),a.fire("dataAdded")}function k(a,c){a.clearLayers();var d=_.reduce(c,function(a,c){return c.setMap(b),a.concat(c.getLayers())},[]);a.addLayers(d)}function l(a,b){a.on("hide",function(){b(!0)}),a.on("show",function(){b(!0)})}function m(a,b){var c;e?c=i(null,a):a.cluster?(c=new L.Knreise.MarkerClusterGroup({dataset:a,maxClusterRadius:f}).addTo(b),z&&z(c,a)):c=i(null,a).addTo(b);var d=!0;return a.minFeatures&&(d=!1),c.enabled=d,c}function n(a,b){a.enabled!==b&&(a.enabled=b,a.fire("changeEnabled"))}function o(a){if(a.datasets&&!a.grouped){var b=_.filter(a.datasets,function(a){return a.visible}).length;return b>0}return a.visible}function p(a){return a.minZoom&&b.getZoom()-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};!function(a){"use strict";function b(a){return turf.featurecollection([turf.simplify(a.features[0],.001,!1)])}function c(a,b){return b=b||{},{polyline:{positions:a,width:5,material:new Cesium.PolylineOutlineMaterialProperty({color:Cesium.Color.ORANGE,outlineWidth:2,outlineColor:Cesium.Color.BLACK})}}}function d(a,b,c){var d=a.layer||"topo2";if("norges_grunnkart_graatone"===d&&(d="norges_grunnkart"),"hist"===d)c(b.getWms("http://wms.geonorge.no/skwms1/wms.historiskekart","historiskekart"));else if("nib"===d){var e="http://knreise.no/nib/?type=token";KR.Util.sendRequest(e,null,function(a){c(0!==a.indexOf("**")?b.getWmts("http://crossorigin.me/http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts","NiB",{TILEMATRIXSET:"EPSG:900913",TILEMATRIX:"EPSG:900913:{TileMatrix}",FORMAT:"image/jpeg",GKT:a}):b.getTiles("http://www.webatlas.no/wacloud/servicerepository/combine.aspx?X={x}&Y={y}&Z={z}&layers=TMS_WEBATLAS_STANDARD:1"))})}else c(b.getWmts("http://opencache.statkart.no/gatekeeper/gk/gk.open_wmts",d,{TILEMATRIXSET:"EPSG:3857",TILEMATRIX:"EPSG:3857:{TileMatrix}",FORMAT:"image/png"}))}function e(a){function b(){e.find(".glyphicon").removeClass("glyphicon-play").addClass("glyphicon-pause"),a.start()}function c(){e.find(".glyphicon").removeClass("glyphicon-pause").addClass("glyphicon-play"),a.stop()}function d(){a.isRunning()?c():b()}var e=$("#playpause");return{play:b,pause:c,toggle:d}}var f={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!1,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!0,navigationInstructionsInitiallyVisible:!1,orderIndependentTranslucency:!1};a.setupMap3d=function(a,g,h){function i(){var b=KR.Config.getDatasets(g,a);return _.chain(b).map(function(a){return a.datasets?a.datasets:a}).flatten().filter(function(a){return _.has(a.dataset,"kommune")&&_.isUndefined(a.dataset.kommune)?!1:!0}).value()}function j(a,b){return new KR.CesiumMap(a,_.extend(f,{limitBounds:h.limitBounds,terrainUrl:h.terrainUrl,enableLighting:h.enableLighting}),b)}function k(b,c,d){_.each(b,function(b){var d=KR.Util.getDatasetId(b),e={template:b.template,datasetId:d,"marker-color":KR.Style.colorForFeature({properties:{datasetId:d}},!1)};o.loadDataset2(b.dataset,c,a,e)}),o.addClickhandler(function(a){q.show(a),d&&d()})}function l(a){o=j("cesium-viewer",a),o.viewer.scene.imageryLayers.removeAll(),d(h,o,o.addImageryProvider),k(i(),a),o.stopLoading()}function m(){var f,g,l=!1;KR.Util.getLine(a,h.line,function(a){if(p=KR.CesiumUtils.getBounds(a),o=j("cesium-viewer",p),d(h,o,o.addImageryProvider),k(i(),p,function(){h.player&&(l=f.isRunning(),g.pause(),f.stop())}),o.build3DLine(a,function(a){var b=c(a,{color:Cesium.Color.DEEPSKYBLUE,glow:.25});o.viewer.zoomTo(o.viewer.entities.add(b)),o.stopLoading()}),h.player){var m=b(a);o.build3DLine(m,function(a){f=new KR.PathTracer(o.viewer,a,m),f.setPitchCorr(.1),g=new e(f),$("#playpause").removeClass("hidden"),$("#playpause").click(g.toggle)}),q.addCloseCb(function(){l&&g.play()})}})}function n(){h.bbox?l(h.bbox):h.komm?a.getMunicipalityBounds(h.komm,l):h.line?m():alert("Missing parameters!")}h=h||{},h=_.extend({player:!0,limitBounds:!1},h);var o,p,q=KR.CesiumSidebar($("#cesium-sidebar"),{});n()}}(KR); \ No newline at end of file +},noListThreshold:0,description:"Personer og eiendommer fra folketellingen 1910"},ark_hist:{grouped:!0,name:"Arkeologi og historie",datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Data fra Universitetsmuseene, Digitalt museum og Riksantikvaren"},jernbane:{id:"jernbane",dataset:{api:"jernbanemuseet"},provider:"Jernbanemuseet",name:"Jernbanemuseet",hideFromGenerator:!0,template:KR.Util.getDatasetTemplate("jernbanemuseet"),getFeatureData:function(a,c){b.getItem({api:"jernbanemuseet",id:a.properties.id},c)},isStatic:!0,bbox:!1,description:"Jernbanemuseet"},arkeologi:{grouped:!0,name:"Arkeologi",style:{fillcolor:"#436978",circle:!1,thumbnail:!0},datasets:[{name:"MUSIT",provider:"Universitetsmuseene",dataset:{api:"norvegiana",dataset:"MUSIT"},template:KR.Util.getDatasetTemplate("musit")},{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER regex(?loccatlabel, "^Arkeologisk", "i") .',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}}],description:"Arkeologidata fra Universitetsmuseene og Riksantikvaren"},historie:{grouped:!0,name:"Historie",style:{fillcolor:"#D252B9",circle:!1,thumbnail:!0},datasets:[{id:"riksantikvaren",name:"Riksantikvaren",provider:"Riksantikvaren",dataset:{filter:'FILTER (!regex(?loccatlabel, "^Arkeologisk", "i"))',api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:5,callback:e.loadKulturminnePoly}},{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"-dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Industrimuseum"},isStatic:!1,bbox:!0},{dataset:{api:"norvegiana",dataset:"Foto-SF"},isStatic:!1,bbox:!1,template:KR.Util.getDatasetTemplate("foto_sf")},{dataset:{api:"norvegiana",dataset:"Kystreise"},isStatic:!0,bbox:!1}],description:"Historie og kulturminner fra Riksantikvaren og Digitalt museum "},kunst:{grouped:!0,name:"Kunst",style:{fillcolor:"#72B026",circle:!1,thumbnail:!0},datasets:[{name:"DiMu",dataset:{api:"norvegiana",dataset:"DiMu",query:"dc_subject_facet:Kunst"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1}],description:"Kunstdata fra Digitalt museum "},wikipedia:{name:"Wikipedia",provider:"Wikipedia",dataset:{api:"wikipedia"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra bokmålswikipedia"},wikipediaNN:{name:"Wikipedia Nynorsk",provider:"Wikipedia Nynorsk",dataset:{api:"wikipediaNN"},style:{thumbnail:!0},minZoom:13,template:KR.Util.getDatasetTemplate("wikipedia"),description:"Stedfestede artikler fra nynorskwikipedia"},lokalwiki:{id:"lokalwiki",name:"Lokalhistoriewiki",hideFromGenerator:!1,provider:"Lokalhistoriewiki",dataset:{api:"lokalhistoriewiki"},style:{thumbnail:!0},minZoom:13,bbox:!0,isStatic:!1,description:"Stedfestede artikler fra lokalhistoriewiki.no"},riksantikvaren:{id:"riksantikvaren",name:"Kulturminnesøk",hideFromGenerator:!1,provider:"Riksantikvaren",dataset:{api:"kulturminnedataSparql",kommune:c,fylke:d},template:KR.Util.getDatasetTemplate("ra_sparql"),bbox:!1,isStatic:!0,init:e.initKulturminnePoly,loadWhenLessThan:{count:10,callback:e.loadKulturminnePoly},description:"Data fra Riksantikvarens kulturminnesøk",showEnkeltminner:!1},brukerminner:{name:"Kulturminnesøk - brukerregistreringer",hideFromGenerator:!1,provider:"riksantikvaren",dataset:{api:"kulturminnedata",layer:2,getExtraData:!0,extraDataLayer:6,matchId:"KulturminnesokID"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Brukerregistrerte data fra Riksantikvarens kulturminnesøk",template:KR.Util.getDatasetTemplate("brukerminne")},groruddalen:{name:"Byantikvaren Oslo - Groruddalen",hideFromGenerator:!0,provider:"Byantikvaren i Oslo",dataset:{api:"cartodb",table:"byantikvaren_oslo_groruddalen"},bbox:!1,isStatic:!1,style:{thumbnail:!0},template:KR.Util.getDatasetTemplate("byantikvaren_oslo"),description:"Byantikvarens Groruddalsatlas"},norgerundt:{name:"Norge Rundt",hideFromGenerator:!0,provider:"NRK",dataset:{api:"cartodb",table:"nrk_norge_rundt"},bbox:!1,isStatic:!1,style:{thumbnail:!0},description:"Stedfestede innslag fra Norge Rundt"},dimu:{name:"Digitalt Museum",hideFromGenerator:!1,provider:"dimu",dataset:{dataset:"DiMu",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Digitalt Museum",allowTopic:!0,feedbackForm:!0},musit:{name:"Universitetsmuseene",hideFromGenerator:!1,provider:"Universitetsmuseene",dataset:{dataset:"MUSIT",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Universitetsmuseene",allowTopic:!0,feedbackForm:!0},industrimuseum:{name:"Industrimuseum",hideFromGenerator:!1,provider:"Industrimuseum",dataset:{dataset:"Industrimuseum",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Industrimuseum",allowTopic:!0,feedbackForm:!0},kystreise:{name:"Kystreise",hideFromGenerator:!1,provider:"Kystreise",dataset:{dataset:"Kystreise",api:"norvegiana"},cluster:!0,isStatic:!1,style:{thumbnail:!0},description:"Alle stedfestede data fra Kystreise",allowTopic:!0,feedbackForm:!0},dimufoto:{hideFromGenerator:!0,dataset:{api:"norvegiana",dataset:"DiMu",query:"europeana_type_facet:IMAGE"},template:KR.Util.getDatasetTemplate("digitalt_museum"),isStatic:!1,style:{thumbnail:!0},noListThreshold:1/0},kulturminnesok_flickr:{name:"Kulturminnesøk",dataset_name_override:"Kulturminnesøk",provider:"Kulturminnesøk Flickr",hideFromGenerator:!0,dataset:{api:"flickr",group_id:"1426230@N24"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!0,style:{thumbnail:!0},description:"Bilder fra Kulturminnesøks Flickr-gruppe"},riksarkivet:{name:"Riksarkivet",dataset_name_override:"Riksarkivet",provider:"riksarkivet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_archives_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Riksarkivets Flickr-konto"},nasjonalbiblioteket:{name:"Nasjonalbiblioteket",dataset_name_override:"Nasjonalbiblioteket",provider:"nasjonalbiblioteket",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"national_library_of_norway"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalbibliotekets Flickr-konto"},oslobyarkiv:{name:"Oslo Byarkiv",dataset_name_override:"Oslo Byarkiv",provider:"oslobyarkiv",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"byarkiv"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Oslo byarkiv sin Flickr-konto"},nasjonalmuseet:{name:"Nasjonalmuseet",dataset_name_override:"Nasjonalmuseet",provider:"nasjonalmuseet",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nasjonalmuseet"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Nasjonalmuseet sin Flickr-konto"},nve:{name:"NVE",dataset_name_override:"NVE",provider:"nve",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"nve",accuracy:"6"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra NVE Flickr-konto"},vestfoldmuseene:{name:"Vestfoldmuseene",dataset_name_override:"Vestfoldmuseene",provider:"Vestfoldmuseene",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"vestfoldmuseene",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Vestfoldmuseene sin Flickr-konto"},perspektivet:{name:"Perspektivet Museum",dataset_name_override:"Perspektivet Museum",provider:"Perspektivet Museum",hideFromGenerator:!0,dataset:{api:"flickr",user_id:"perspektivetmuseum",accuracy:"1"},template:KR.Util.getDatasetTemplate("flickr"),isStatic:!1,style:{thumbnail:!0},description:"Bilder fra Perspektivet Museum sin Flickr-konto"}};if(!c&&!d){var g={bbox:!0,minZoom:12,isStatic:!1,bboxFunc:KR.Util.sparqlBbox};_.extend(f.riksantikvaren,g),_.extend(f.ark_hist.datasets[2],g),_.extend(f.arkeologi.datasets[1],g),_.extend(f.historie.datasets[0],g)}return f},a.getDatasets=function(b,c,d,e){var f=a.getDatasetList(c,d,e);return _.chain(b).map(function(a){var b;if(a.indexOf(":")>-1){var c=a.split(":");a=c[0],b=c[1]}if(_.has(f,a)){var d=f[a];return b&&"norvegiana"===d.dataset.api&&(d.dataset.query="dc_subject_text:"+b),d}}).compact().value()}}(KR.Config);var KR=this.KR||{};!function(a){"use strict";function b(a){return turf.featurecollection([turf.simplify(a.features[0],.001,!1)])}function c(a,b){return b=b||{},{polyline:{positions:a,width:5,material:new Cesium.PolylineOutlineMaterialProperty({color:Cesium.Color.ORANGE,outlineWidth:2,outlineColor:Cesium.Color.BLACK})}}}function d(a,b,c){var d=a.layer||"topo2";if("norges_grunnkart_graatone"===d&&(d="norges_grunnkart"),"hist"===d)c(b.getWms("http://wms.geonorge.no/skwms1/wms.historiskekart","historiskekart"));else if("nib"===d){var e="http://knreise.no/nib/?type=token";KR.Util.sendRequest(e,null,function(a){c(0!==a.indexOf("**")?b.getWmts("http://crossorigin.me/http://gatekeeper1.geonorge.no/BaatGatekeeper/gk/gk.nibcache_wmts","NiB",{TILEMATRIXSET:"EPSG:900913",TILEMATRIX:"EPSG:900913:{TileMatrix}",FORMAT:"image/jpeg",GKT:a}):b.getTiles("http://www.webatlas.no/wacloud/servicerepository/combine.aspx?X={x}&Y={y}&Z={z}&layers=TMS_WEBATLAS_STANDARD:1"))})}else c(b.getWmts("http://opencache.statkart.no/gatekeeper/gk/gk.open_wmts",d,{TILEMATRIXSET:"EPSG:3857",TILEMATRIX:"EPSG:3857:{TileMatrix}",FORMAT:"image/png"}))}function e(a){function b(){e.find(".glyphicon").removeClass("glyphicon-play").addClass("glyphicon-pause"),a.start()}function c(){e.find(".glyphicon").removeClass("glyphicon-pause").addClass("glyphicon-play"),a.stop()}function d(){a.isRunning()?c():b()}var e=$("#playpause");return{play:b,pause:c,toggle:d}}var f={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!1,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!0,navigationInstructionsInitiallyVisible:!1,orderIndependentTranslucency:!1};a.setupMap3d=function(a,g,h){function i(){var b=KR.Config.getDatasets(g,a);return _.chain(b).map(function(a){return a.datasets?a.datasets:a}).flatten().filter(function(a){return _.has(a.dataset,"kommune")&&_.isUndefined(a.dataset.kommune)?!1:!0}).value()}function j(a,b){return new KR.CesiumMap(a,_.extend(f,{limitBounds:h.limitBounds,terrainUrl:h.terrainUrl,enableLighting:h.enableLighting}),b)}function k(b,c,d){_.each(b,function(b){var d=KR.Util.getDatasetId(b),e={template:b.template,datasetId:d,"marker-color":KR.Style.colorForFeature({properties:{datasetId:d}},!1)};o.loadDataset2(b.dataset,c,a,e)}),o.addClickhandler(function(a){q.show(a),d&&d()})}function l(a){o=j("cesium-viewer",a),o.viewer.scene.imageryLayers.removeAll(),d(h,o,o.addImageryProvider),k(i(),a),o.stopLoading()}function m(){var f,g,l=!1;KR.Util.getLine(a,h.line,function(a){if(p=KR.CesiumUtils.getBounds(a),o=j("cesium-viewer",p),d(h,o,o.addImageryProvider),k(i(),p,function(){h.player&&(l=f.isRunning(),g.pause(),f.stop())}),o.build3DLine(a,function(a){var b=c(a,{color:Cesium.Color.DEEPSKYBLUE,glow:.25});o.viewer.zoomTo(o.viewer.entities.add(b)),o.stopLoading()}),h.player){var m=b(a);o.build3DLine(m,function(a){f=new KR.PathTracer(o.viewer,a,m),f.setPitchCorr(.1),g=new e(f),$("#playpause").removeClass("hidden"),$("#playpause").click(g.toggle)}),q.addCloseCb(function(){l&&g.play()})}})}function n(){h.bbox?l(h.bbox):h.komm?a.getMunicipalityBounds(h.komm,l):h.line?m():alert("Missing parameters!")}h=h||{},h=_.extend({player:!0,limitBounds:!1},h);var o,p,q=KR.CesiumSidebar($("#cesium-sidebar"),{});n()}}(KR); \ No newline at end of file diff --git a/dist/scripts_external.js b/dist/scripts_external.js index b407f250..d2056a0e 100644 --- a/dist/scripts_external.js +++ b/dist/scripts_external.js @@ -33,7 +33,7 @@ L.TileLayer.addInitHook(function(){if(!this.options.useCache){this._db=null;this var esri2geo={};(function(){function toGeoJSON(data,cb){if(typeof data==="string"){if(cb){ajax(data,function(err,d){toGeoJSON(d,cb)});return}else{throw new TypeError("callback needed for url")}}var outPut={type:"FeatureCollection",features:[]};var fl=data.features.length;var i=0;while(fl>i){var ft=data.features[i];var outFT={type:"Feature",properties:prop(ft.attributes)};if(ft.geometry.x){outFT.geometry=point(ft.geometry)}else if(ft.geometry.points){outFT.geometry=points(ft.geometry)}else if(ft.geometry.paths){outFT.geometry=line(ft.geometry)}else if(ft.geometry.rings){outFT.geometry=poly(ft.geometry)}outPut.features.push(outFT);i++}cb(null,outPut)}function point(geometry){return{type:"Point",coordinates:[geometry.x,geometry.y]}}function points(geometry){if(geometry.points.length===1){return{type:"Point",coordinates:geometry.points[0]}}else{return{type:"MultiPoint",coordinates:geometry.points}}}function line(geometry){if(geometry.paths.length===1){return{type:"LineString",coordinates:geometry.paths[0]}}else{return{type:"MultiLineString",coordinates:geometry.paths}}}function poly(geometry){if(geometry.rings.length===1){return{type:"Polygon",coordinates:geometry.rings}}else{return decodePolygon(geometry.rings)}}function decodePolygon(a){var coords=[],type;var len=a.length;var i=0;var len2=coords.length-1;while(len>i){if(ringIsClockwise(a[i])){coords.push([a[i]]);len2++}else{coords[len2].push(a[i])}i++}if(coords.length===1){type="Polygon"}else{type="MultiPolygon"}return{type:type,coordinates:coords.length===1?coords[0]:coords}}function ringIsClockwise(ringToTest){var total=0,i=0,rLength=ringToTest.length,pt1=ringToTest[i],pt2;for(i;i=0}function prop(a){var p={};for(var k in a){if(a[k]){p[k]=a[k]}}return p}function ajax(url,cb){if(typeof module!=="undefined"){var request=require("request");request(url,{json:true},function(e,r,b){cb(e,b)});return}var response;var req=new XMLHttpRequest;req.onreadystatechange=function(){if(req.readyState===4&&req.status===200){cb(null,JSON.parse(req.responseText))}};req.open("GET",url);req.send()}if(typeof module!=="undefined"){module.exports=toGeoJSON}else{esri2geo.toGeoJSON=toGeoJSON}})(); -/*! KNreiseAPI 1.7.19 2015-11-11 */ +/*! KNreiseAPI 1.7.20 2015-11-11 */ var KR=this.KR||{};KR.Util={},function(a){"use strict";function b(a){return a*Math.PI/180}a.dictWithout=function(a){var b=_.without(_.keys(a),Array.prototype.slice.call(arguments,1));return _.reduce(b,function(b,c){return b[c]=a[c],b},{})},a.createQueryParameterString=function(a){return _.map(a,function(a,b){return encodeURIComponent(b)+"="+encodeURIComponent(a)}).join("&")},a.handleError=function(a,b,c){if(a)return void a({error:b,data:c});throw new Error(b)},a.sendRequest=function(b,c,d,e,f){return f=f||{},$.ajax({type:"get",beforeSend:function(a){_.each(f,function(b,c){a.setRequestHeader(c,b)})},url:b,success:function(b){if(c){var f;try{f=c(b,e)}catch(g){return void a.handleError(e,g.message,b)}_.isUndefined(f)||d(f)}else d(b)},error:e})},a.createGeoJSONFeature=function(a,b,c){return b=b||{},{type:"Feature",geometry:{type:"Point",coordinates:[a.lng,a.lat]},properties:b,id:c}},a.createGeoJSONFeatureFromGeom=function(a,b,c){return b=b||{},{type:"Feature",geometry:a,properties:b,id:c}},a.createFeatureCollection=function(a){return{type:"FeatureCollection",features:a}},a.stamp=function(){var a=0,b="_knreise_id";return function(c){return c[b]=c[b]||++a,c[b]}}(),a.haversine=function(a,c,d,e){var f=6371e3,g=b(a),h=b(d),i=b(d-a),j=b(e-c),k=Math.sin(i/2)*Math.sin(i/2)+Math.cos(g)*Math.cos(h)*Math.sin(j/2)*Math.sin(j/2),l=2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k));return f*l},a.splitBbox=function(a){return a.split(",").map(parseFloat)},a.addCrossorigin=function(a){return 0!==a.indexOf("http://crossorigin.me/")?"http://crossorigin.me/"+a:a}}(KR.Util);var KR=this.KR||{};KR.ArcgisAPI=function(a,b){"use strict";function c(a){return a=KR.Util.splitBbox(a),JSON.stringify({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3]})}function d(a,b,c){b=JSON.parse(b);var d=b.features,e=_.map(a.features,function(a){var b=_.find(d,function(b){return b.attributes[c.matchId]===a.properties[c.matchId]});b&&(b=b.attributes,a.properties.thumbnail=b.UrlTilBilde);var e=_.extend(a.properties,{extra:b});return KR.Util.createGeoJSONFeatureFromGeom(a.geometry,e,a.id)});return KR.Util.createFeatureCollection(e)}function e(a,b,c,e){var f=_.map(a.features,function(a){return a.properties[b.matchId]}),g={where:b.matchId+" IN ("+f.join(",")+")",outFields:"*",returnGeometry:!1,returnIdsOnly:!1,returnCountOnly:!1,returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"pjson"},i=h+b.extraDataLayer+"/query";$.ajax({type:"POST",url:i,data:KR.Util.createQueryParameterString(g),success:function(e){c(d(a,e,b))},error:function(b){c(a)}})}function f(b,c,d,f){try{b=JSON.parse(b)}catch(g){}return _.has(b,"error")?void KR.Util.handleError(d,b.error.message):void esri2geo.toGeoJSON(b,function(b,g){b?c(KR.Util.createFeatureCollection([])):(_.each(g.features,function(b){_.has(b.properties,"Navn")&&(b.properties.title=b.properties.Navn),b.id=a+"_"+b.properties.OBJECTID}),f.getExtraData?e(g,f,c,d):c(g))})}function g(a,b,d,e){var g={geometry:c(b),geometryType:"esriGeometryEnvelope",inSR:4326,spatialRel:"esriSpatialRelIntersects",outFields:"*",returnGeometry:!0,outSR:4326,returnIdsOnly:!1,returnCountOnly:!1,outStatistics:"",returnZ:!1,returnM:!1,returnDistinctValues:!1,f:"json"};a.query&&(g.where=a.query);var i=a.layer,j=h+i+"/query?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(j,null,function(b){f(b,d,e,a)},e)}var h=b.url;return{getBbox:g}};var KR=this.KR||{};KR.CartodbAPI=function(a,b){"use strict";function c(a){return"http://"+a+".cartodb.com/api/v2/sql"}function d(a){return function(b){var c=_.map(b.rows,function(b){var c=JSON.parse(b.geom),d=_.reduce(b,function(b,c,d){if(_.has(a,d)){var e=a[d];_.isArray(e)?_.each(e,function(a){b[a]=c}):b[e]=c}return b},{});return{type:"Feature",geometry:c,properties:d}});return KR.Util.createFeatureCollection(c)}}function e(){return _.reduce(r,function(a,b,c){return a[c]=d(b),a},{cartodb_general:function(a){var b=_.map(a.rows,function(a){var b=JSON.parse(a.geom);return{type:"Feature",geometry:b,properties:_.omit(a,"geom")}});return KR.Util.createFeatureCollection(b)}})}function f(a,b,d,e,f){var g={q:a},h=f||q,i=c(h)+"?"+KR.Util.createQueryParameterString(g);KR.Util.sendRequest(i,b,d,e)}function g(a){var b=a.rows[0].st_extent;return b.replace("BOX(","").replace(")","").replace(/ /g,",")}function h(a,b,c){var d=["SELECT "+a,"FROM "+b];return c&&d.push("WHERE "+c),d.join(" ")}function i(a,b){return"ST_DWithin(the_geom::geography,'POINT("+a.lng+" "+a.lat+")'::geography, "+b+");"}function j(a){var b=a.mapper;return b||(b=e().cartodb_general),b}function k(a){return _.isArray(a)?a:[a]}function l(a,b,c){var d=h("ST_Extent(the_geom)","kommuner","komm in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function m(a,b,c){var d=h("ST_Extent(the_geom)","fylker","fylkesnr in ("+k(a).join(", ")+")");f(d,g,b,c,"knreise")}function n(a,b,c){var d,e=j(a);if(a.query)d=a.query;else if(a.table){var g=a.columns;g||(g=["*"]),_.has(r,a.table)&&(g=_.keys(r[a.table])),g.push("ST_AsGeoJSON(the_geom) as geom"),d="SELECT "+g.join(", ")+" FROM "+a.table}else a.county?d=h("ST_AsGeoJSON(the_geom) as geom","fylker","fylkesnr in ("+k(a.county).join(", ")+")"):a.municipality&&(d=h("ST_AsGeoJSON(the_geom) as geom","kommuner","komm in ("+k(a.municipality).join(", ")+")"));d&&f(d,e,b,c)}function o(a,b,c,d){var e=a.columns;e||(e=["*"]),e.push("ST_AsGeoJSON(the_geom) as geom");var g=h(e.join(", "),a.table,"ST_Intersects(the_geom, ST_MakeEnvelope("+b+", 4326))"),i=j(a);f(g,i,c,d)}function p(a,b,c,d,e){var g=_.keys(r["default"]).concat(["ST_AsGeoJSON(the_geom) as geom"]).join(", "),j=h(g,a.table,i(b,c));f(j,s,d,e)}var q=b.user,r={"default":{delving_thumbnail:["images","thumbnail"],dc_title:"title",dc_description:"content",europeana_isshownat:"link",europeana_collectiontitle:"dataset",abm_contentProvider:"provider",europeana_type:"contentType",delving_landingpage:"video"},pilegrimsleden_dovre:{iid:"id",name:"name",omradenavn:"omradenavn"}},s=d(r["default"]);return{getBbox:o,getData:n,getWithin:p,getMunicipalityBounds:l,getCountyBounds:m,mappers:e}};var KR=this.KR||{};KR.NorvegianaAPI=function(a){"use strict";function b(a){return a.lat+","+a.lng}function c(a){return a&&a.length?a[0]:null}function d(a){return a&&-1!==a.indexOf("www.youtube.com/watch")?"https://www.youtube.com/embed/"+a.substr(a.indexOf("watch?v=")+8):a}function e(a){return _.chain(a.item.fields).pairs().where(function(a){return"abm_latLong"!==a[0]}).reduce(function(a,b){return a[b[0]]=b[1],a},{}).value()}function f(a){var b=75;return a&&a.indexOf("width=")>-1&&a.indexOf("height=")>-1?a.replace(/(width=)(\d+)/g,"$1"+b).replace(/(height=)(\d+)/g,"$1"+b):a}function g(a,b){return _.chain(b).reduce(function(b,c){return _.has(a,c)&&(b=b.concat(a[c])),b},[]).uniq().value()}function h(a){return _.chain(a).map(function(a,b){return _.map(a,function(a){return{type:b,url:a}})}).flatten().value()}function i(a){var b=c(a.delving_thumbnail),e=g(a,["delving_thumbnail","abm_imageUri"]),i={video:_.map(a.abm_videoUri,d),sound:a.abm_soundUri,image:e};return{thumbnail:f(b),images:e,title:c(a.dc_title),content:_.map(a.dc_description,function(a){return"

"+a+"

"}).join("\n"),link:c(a.europeana_isShownAt),dataset:c(a.europeana_collectionTitle),provider:c(a.abm_contentProvider),contentType:c(a.europeana_type),video:c(a.abm_videoUri),videoEmbed:d(c(a.abm_videoUri)),sound:c(a.abm_soundUri),allProps:a,media:h(i)}}function j(b){var c,d=e(b),f=i(d),g=_.map(b.item.fields.abm_latLong[0].split(","),parseFloat);_.has(d,"delving_hubId")&&(c=a+"_"+d.delving_hubId[0]);var h=KR.Util.createGeoJSONFeature({lat:g[0],lng:g[1]},f,c);return h}function k(a){var b;a.result.pagination.hasNext&&(b=a.result.pagination.nextPage);var c=_.map(a.result.items,j),d=KR.Util.createFeatureCollection(c);return d.numFound=a.result.pagination.numFound,{geoJSON:d,nextPage:b}}function l(a,b,c){var d=[];return function e(f){if(d.push(f.geoJSON),f.nextPage)return void KR.Util.sendRequest(a+"&start="+f.nextPage,k,e,c);var g=_.reduce(d,function(a,b){return a.concat(b.features)},[]);b(KR.Util.createFeatureCollection(g))}}function m(a){return a=_.isArray(a)?a:[a],_.map(a,function(a){return"delving_spec:"+a}).join(" OR ")}function n(a){x[a]&&(x[a].abort(),x[a]=null)}function o(a,b,c){return KR.Util.sendRequest(a,k,function(a){b(a.geoJSON)},c)}function p(a,b,c){return KR.Util.sendRequest(a,k,l(a,b,c),c)}function q(a,b,c,d,e){var f=m(b.dataset);a=_.extend({query:f,format:"json",rows:1e3},a),a.query+=" delving_hasGeoHash:true";var g=f;b.query&&(a.qf=b.query,g+=b.query),n(g);var h=y+"?"+KR.Util.createQueryParameterString(a);e.allPages?x[g]=p(h,c,d):x[g]=o(h,c,d)}function r(a,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(j,k,l,k),KR.Util.haversine(l,g,l,k)]),n={pt:b({lat:l,lng:k}),d:m/1e3,geoType:"bbox"};q(n,a,d,e,f)}function s(a,c,d,e,f,g){var h={pt:b(c),d:d/1e3};q(h,a,e,f,g)}function t(a,b,c,d){if(a.query&&_.isArray(a.query)){var e="delving_spec:"+a.dataset+" AND ("+a.query.join(" OR ")+") AND delving_hasGeoHash:true",f={query:e,format:"json",rows:1e3},g=e;n(g);var h=y+"?"+KR.Util.createQueryParameterString(f);return void(d.allPages?x[g]=p(h,b,c):x[g]=o(h,b,c))}q({},a,b,c,d)}function u(a,b,c){var d={id:a.id,format:"json"},e=y+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(a){return j(a.result)},b,c)}function v(b){var c=_.map(b.geo_json.features,function(b){var c,d=i(b.properties);return _.has(d.allProps,"delving_hubId")&&(c=a+"_"+d.allProps.delving_hubId),b.properties=d,b.id=c,b});return b.geo_json=KR.Util.createFeatureCollection(c),b}function w(a,b,c){var d=z+a;KR.Util.sendRequest(d,v,b,c)}var x=[],y="http://kulturnett2.delving.org/api/search",z="http://acc.norvegiana.delving.org/en/api/knreise-collection/";return{getWithin:s,getItem:u,getBbox:r,getData:t,getCollection:w}};var KR=this.KR||{};KR.WikipediaAPI=function(a,b){"use strict";function c(a,b){var c=n+"?"+KR.Util.createQueryParameterString(a);KR.Util.sendRequest(c,null,function(a){try{a=JSON.parse(a)}catch(c){}b(a)})}function d(a,b){function d(f){if(_.each(f.query.pages,function(a,b){_.has(e,b)?e[b]=_.extend(e[b],a):e[b]=a}),_.has(f,"continue")){var g={};_.has(f["continue"],"picontinue")&&(g.picontinue=f["continue"].picontinue),_.has(f["continue"],"excontinue")&&(g.excontinue=f["continue"].excontinue);var h=_.extend(g,a);c(h,d)}else b(e)}var e={};c(a,d)}function e(a){var b="http://upload.wikimedia.org/wikipedia/commons/",c=CryptoJS.MD5(a).toString();return b+c.substr(0,1)+"/"+c.substr(0,2)+"/"+a}function f(a,b){var c={action:"query",prop:"extracts|pageimages",exlimit:"max",exintro:"",pilimit:"max",pageids:a,format:"json","continue":""};d(c,b)}function g(b,c){c=c||{};var d=c[b.pageid];d&&(b=_.extend(b,d));var f;_.has(b,"thumbnail")&&(f=b.thumbnail.source);var g=null;b.pageimage&&(g=[e(b.pageimage)]);var h=o+b.pageid,i={thumbnail:f,images:g,title:b.title,content:b.extract,link:h,dataset:"Wikipedia",provider:"Wikipedia",contentType:"TEXT",id:b.pageid};return KR.Util.createGeoJSONFeature({lat:b.lat,lng:b.lon},i,a+"_"+b.pageid)}function h(a,b,c){try{a=JSON.parse(a)}catch(d){}try{var e=_.pluck(a.query.geosearch,"pageid");e.length?f(e.join("|"),function(c){var d=_.map(a.query.geosearch,function(a){return g(a,c)});b(KR.Util.createFeatureCollection(d))}):b(KR.Util.createFeatureCollection([]))}catch(h){KR.Util.handleError(c,a.error.info)}}function i(a,b,c,d,e){if(c>m)return void KR.Util.handleError(e,"to wide search radius (max is "+m+")");var f={action:"query",list:"geosearch",gsradius:c,gscoord:b.lat+"|"+b.lng,format:"json",gslimit:50},g=n+"?"+KR.Util.createQueryParameterString(f);KR.Util.sendRequest(g,null,function(a){h(a,d,e)},e)}function j(a){var b=_.chain(a).reduce(function(a,b){return _.each(b,function(b,c){_.has(a,c)?a[c]=_.extend(a[c],b):a[c]=b}),a},{}).filter(function(a){return _.has(a,"coordinates")}).map(function(a){return a.lat=a.coordinates[0].lat,a.lon=a.coordinates[0].lon,a}).map(g).value();return KR.Util.createFeatureCollection(b)}function k(a,b,c,d){function e(a){var d=_.extend({},f,a),h=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(h,null,function(a){g.push(a.query.pages),_.has(a,"continue")?e(a["continue"]):b(j(g))},c)}var f={action:"query",generator:"categorymembers",gcmtitle:"Kategori:"+a.category,prop:"coordinates",format:"json"},g=[];e({"continue":""})}function l(a,b,c){var d={action:"query",pageids:a.id,prop:"coordinates|pageimages|extracts",format:"json"},e=n+"?"+KR.Util.createQueryParameterString(d);KR.Util.sendRequest(e,function(b){return g(b.query.pages[a.id])},b,c)}var m=b.maxRadius||1e4,n=b.url,o=b.linkBase;return{getWithin:i,getData:k,getItem:l}};var KR=this.KR||{};KR.UtnoAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");if("gpx"===a.type){var d="http://ut.no/tur/"+a.id+"/gpx/";KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}else KR.Util.handleError(c,"Unknown type "+a.type)}return{getData:b}};var KR=this.KR||{};KR.FolketellingAPI=function(a){"use strict";function b(b){var c=_.map(b.results,function(b){var c=KR.Util.dictWithout(b,"latitude","longitude"),d={lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)};return KR.Util.createGeoJSONFeature(d,c,a+"_"+b.autoid)});return KR.Util.createFeatureCollection(c)}function c(a,c,d,e,f,i){var j=a.limit||1e3;if("property"!==a.dataset)return void KR.Util.handleError(f,"unknown dataset "+a.dataset);if(d>h)return void KR.Util.handleError(f,"to wide search radius");var k={latitude:c.lat,longitude:c.lng,precision:d,limit:j},l=g+"search_property_geo?"+KR.Util.createQueryParameterString(k);KR.Util.sendRequest(l,b,e,f)}function d(a,b,c){if(0===a.property.id.indexOf("gf")){if(!a.apartments)return a.apartments=null,void b({properties:a});var d=[],e=_.after(a.apartments.length,function(){a.apartments=d,b({properties:a})});return void _.each(a.apartments,function(a){f({type:"apartmentData",apartmentId:a.id},function(a){d.push(a),e()})})}b({properties:a})}function e(a){return a.apartments||(a.apartments=null),{properties:a}}function f(a,b,c,f){var h;"propertyData"===a.type&&a.propertyId?(h=g+"property/"+a.propertyId,a.withPersons?KR.Util.sendRequest(h,null,function(a){d(a,b,c)},c):KR.Util.sendRequest(h,e,b,c)):"apartmentData"===a.type&&a.apartmentId?(h=g+"property/"+a.apartmentId,KR.Util.sendRequest(h,null,b,c)):KR.Util.handleError(c,"Not enough parameters")}var g="http://api.digitalarkivet.arkivverket.no/v1/census/1910/",h=5e3;return{getData:f,getWithin:c}};var KR=this.KR||{};KR.SparqlAPI=function(a,b){"use strict";function c(a){if("undefined"==typeof proj4)throw new Error("Proj4js not found!");return proj4("EPSG:32633","EPSG:4326",a)}function d(a){return a=wellknown.parse(a.value),"Point"===a.type&&(a.coordinates=c(a.coordinates)),"Polygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a,c)})),"MultiPolygon"===a.type&&(a.coordinates=_.map(a.coordinates,function(a){return _.map(a.coordinates,function(a){return _.map(a,c)})})),a}function e(b,c){var e=_.map(b.results.bindings,function(b){var c=_.without(_.keys(b),"point","omraade"),e=_.reduce(c,function(a,c){return a[c]=b[c].value,a},{});return e.img||(e.img=!1),e.title=e.name,_.has(b,"point")?KR.Util.createGeoJSONFeatureFromGeom(d(b.point),e,a+"_"+e.id):_.has(b,"omraade")?KR.Util.createGeoJSONFeatureFromGeom(d(b.omraade),e,a+"_"+e.id):null});return KR.Util.createFeatureCollection(e)}function f(a,b){var c=a.results.bindings;if(!c||0===c.length)return void KR.Util.handleError(b);var e=_.map(c,function(a){return a.lok.type="Polygon",KR.Util.createGeoJSONFeatureFromGeom(d(a.lok),{})}),f=_.map(e,function(a){return a.geometry}),g={type:"GeometryCollection",geometries:f};return KR.Util.createGeoJSONFeatureFromGeom(g,{})}function g(a,b,c,d){var e={"default-graph-uri":"",query:a,format:"application/sparql-results+json",timeout:0,debug:"off"},f=o+"?"+KR.Util.createQueryParameterString(e);KR.Util.sendRequest(f,b,c,d)}function h(a){if(a.kommune){var b="select distinct ?id ?name ?description ?loccatlabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link { ?id a ?type ; rdfs:label ?name ; ?description ; ?loccat ; ?p ; ?point . ?loccat rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=600&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) }';return a.filter&&(b+=" "+a.filter),b+="}",a.limit&&(b+="LIMIT "+a.limit),b}}function i(a){if(a.fylke){var b=parseInt(a.fylke,10);10>b&&(b="0"+b);var c='select ?id ?name ?description ?loccatlabel (SAMPLE(?point) as ?point) ?img ?thumbnail ?url as ?link { ?id a ?type . ?id rdfs:label ?name . ?id ?kommune . ?id ?description . ?id ?lokalitetskategori . ?lokalitetskategori rdfs:label ?loccatlabel . BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://www.kulturminnesok.no/kulturminnesok/kulturminne/?LOK_ID=", ?lokid) AS ?url) ?id ?point . optional { ?picture ?id . ?picture ?link BIND(REPLACE(STR(?id), "https://data.kulturminne.no/askeladden/lokalitet/", "") AS ?lokid) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=400&rs=0&pg=0&sr=", ?lokid) AS ?img) BIND(bif:concat("http://kulturminnebilder.ra.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5001&sz=75&rs=0&pg=0&sr=", ?lokid) AS ?thumbnail) } FILTER regex(?kommune, "^.*'+b+'[0-9]{2}") .';return a.filter&&(c+=" "+a.filter),c+=" } order by ?img",a.limit&&(c+="LIMIT "+a.limit),c}}function j(a){return"SELECT ?lok where { <"+a.trim()+"> ?lok . }"}function k(a){return"SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel where { ?enk a . ?enk rdfs:label ?name . ?enk <"+a.trim()+"> . ?enk ?desc . ?enk ?area . ?enk ?enkcat . ?enkcat rdfs:label ?enkcatlabel . } "}function l(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var e=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(e))});_.each(d,function(a){g(j(a),f,function(b){b.properties.lok=a,e.push(b),h()},c)})}function m(a,b,c){var d=[];_.isArray(a.lokalitet)?d=a.lokalitet:d.push(a.lokalitet);var f=[],h=_.after(d.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d,function(a){g(k(a),e,function(b){var c=_.map(b.features,function(b){return b.properties.lokalitet=a,b});f=f.concat(c),h()},c)})}function n(a,b,c,d){if(a=_.extend({},{geomType:"point"},a),a.kommune){var f=h(a,c);g(f,e,b,c)}else if(a.fylke){var f=i(a,c);g(f,e,b,c)}else a.lokalitet&&"lokalitetpoly"===a.type?l(a,b,c):a.lokalitet&&"enkeltminner"===a.type?m(a,b,c):a.sparqlQuery?g(a.sparqlQuery,e,b,c):KR.Util.handleError(c,"not enough parameters")}var o=b.url;return"undefined"!=typeof proj4&&proj4.defs([["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),{getData:n}};var KR=this.KR||{};KR.FlickrAPI=function(a,b){"use strict";function c(a,b){return l(_.extend({size:b},a))}function d(b,d){if(b.stat&&"fail"===b.stat)return void KR.Util.handleError(d,b.message,b);var e=_.chain(b.photos.photo).filter(function(a){var b=parseFloat(a.latitude),c=parseFloat(a.longitude);return 0!=b||0!=c}).map(function(b){var d=KR.Util.dictWithout(b,"latitude","longitude");return d.thumbnail=c(b,"s"),d.image=c(b,"z"),KR.Util.createGeoJSONFeature({lat:parseFloat(b.latitude),lng:parseFloat(b.longitude)},d,a+"_"+b.id)}).value();return KR.Util.createFeatureCollection(e)}function e(a,b,c){function e(e){var h=d(e,c);if(h&&h.features&&(g=g.concat(h.features)),e.photos&&e.photos.page.staticflickr.com/<%= server %>/<%= id %>_<%= secret %>_<%= size %>.jpg");return{getData:i,getWithin:g,getBbox:h}};var KR=this.KR||{};KR.KmlAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.kml,b,c)}return{getData:b}};var KR=this.KR||{};KR.GpxAPI=function(a){"use strict";function b(a,b,c){if("undefined"==typeof toGeoJSON)throw new Error("toGeoJSON not found!");var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,toGeoJSON.gpx,b,c)}return{getData:b}};var KR=this.KR||{};KR.GeoJsonAPI=function(a){"use strict";function b(a,b,c){var d=KR.Util.addCrossorigin(a.url);KR.Util.sendRequest(d,JSON.parse,b,c)}return{getData:b}};var KR=this.KR||{};KR.JernbanemuseetAPI=function(a,b){"use strict";function c(a){return _.has(a,"group")?a.group:l}function d(){return{"api-key":o}}function e(b){var c=_.map(b.data.records,function(b){var c,d=_.extend(b.contents[m],{id:b.record_id});return _.has(b,"latitude")&&_.has(b,"longitude")?c={lat:b.latitude,lng:b.longitude}:_.has(b,"location")?c={lat:b.location.latitude,lng:b.location.longitude}:console.error("no geometry"),KR.Util.createGeoJSONFeature(c,d,a+"_"+b.record_id)});return KR.Util.createFeatureCollection(c)}function f(a){return _.map(a.blocks,function(a){if("text"===a.type)return{text:a.data,type:a.type};if("image_video"===a.type||"audio"===a.type){var b=_.map(a.data,function(a){var b;"image"===a.type&&(b=a.url),"video"===a.type&&(b=a.url.mp4),"audio"===a.type&&(b=a.url.ogg);var c="",d="";return _.has(a.contents,m)&&(c=a.contents[m].description,d=a.contents[m].title),{title:d,description:c,type:a.type,url:b}});return{media:b,type:a.type}}return"links"===a.type?{links:a.data,type:"links"}:void 0})}function g(b){var c,d,e=b.data.contents[m],g={lat:b.data.location.latitude,lng:b.data.location.longitude},h=b.data.id,i=_.map(e.pages,function(a){return{title:a.title,blocks:f(a)}});b.data.images.length&&(c=_.pluck(b.data.images,"url"),d=b.data.images[0].thumbnail);var j={license:b.data.license.description,id:h,thumbnail:d,images:c,title:e.title,description:e.description,pages:i};return KR.Util.createGeoJSONFeature(g,j,a+"_"+h)}function h(a,b,e){var f=n+"/groups/"+c(a)+"/records/"+a.id+"?strip_html=true";KR.Util.sendRequest(f,g,b,e,d())}function i(a,b,c){var d=e(a),f=[],g=_.after(d.features.length,function(){b(KR.Util.createFeatureCollection(f))});_.each(d.features,function(a){h(a.properties.id,function(a){f.push(a),g()},function(){g()})})}function j(a,b,f,g,h,j){var k={lat:b.lat,"long":b.lng,radius:f},l=n+"/groups/"+c(a)+"/nearby?"+KR.Util.createQueryParameterString(k);j.getDetails?KR.Util.sendRequest(l,null,function(a){i(a,g,h)},null,d()):KR.Util.sendRequest(l,e,g,h,d())}function k(a,b,f,g){var h=n+"/groups/"+c(a)+"/geography";g.getDetails?KR.Util.sendRequest(h,null,function(a){i(a,b,f)},null,d()):(a.presentation&&(h="https://api.kulturpunkt.org/v2/owners/54/presentations/"+a.presentation),KR.Util.sendRequest(h,e,b,f,d()))}var l=192,m=b.lang||"no",n="https://api.kulturpunkt.org/v2/owners/54",o=b.apikey;return{getData:k,getWithin:j,getItem:h}};var KR=this.KR||{};KR.API=function(a){"use strict";function b(){return _.reduce(k,function(b,c,d){var e=c.params;return c.extend&&(e=_.extend(e,a[d])),b[d]=new c.api(d,e),b},{})}function c(a,b,c,d,e,f){c=KR.Util.splitBbox(c);var g=c[0],h=c[1],i=c[2],j=c[3],k=(g+i)/2,l=(h+j)/2,m=_.max([KR.Util.haversine(h,g,l,k),KR.Util.haversine(j,i,l,k)]),n={lat:l,lng:k};a.getWithin(b,n,m,d,e,f)}function d(a){var b=l[a];if(b)return b;throw new Error("Unknown API")}function e(a,b,c,e){e=e||{};var f=d(a.api);f.getData(a,b,c,e)}function f(a,b,e,f,g){g=g||{};var h=d(a.api);_.has(h,"getBbox")?h.getBbox(a,b,e,f,g):c(h,a,b,e,f,g)}function g(a,b,c,e,f,g){g=g||{},c=c||5e3;var h=d(a.api);h.getWithin(a,b,c,e,f,g)}function h(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getMunicipalityBounds(a,b,c)}function i(a,b,c){var e=d("cartodb");if(!e)throw new Error("CartoDB api not configured!");e.getCountyBounds(a,b,c)}function j(a,b,c){var e=d(a.api);if(_.has(e,"getItem"))e.getItem(a,b,c);else{if(!c)throw new Error("No getItem function for api "+a.api);c("No getItem function for api "+a.api)}}a=a||{};var k={norvegiana:{api:KR.NorvegianaAPI,params:{}},wikipedia:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://no.wikipedia.org/w/api.php",linkBase:"http://no.wikipedia.org/?curid="}},wikipediaNN:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/https://nn.wikipedia.org/w/api.php",linkBase:"http://nn.wikipedia.org/?curid="}},cartodb:{api:KR.CartodbAPI,extend:!0,params:{user:"knreise"}},kulturminnedata:{api:KR.ArcgisAPI,params:{url:"http://husmann.ra.no/arcgis/rest/services/Husmann/Husmann/MapServer/"}},kulturminnedataSparql:{api:KR.SparqlAPI,params:{url:"https://sparql.kulturminne.no/"}},utno:{api:KR.UtnoAPI,params:{}},folketelling:{api:KR.FolketellingAPI,params:{}},flickr:{api:KR.FlickrAPI,extend:!0,params:{}},kml:{api:KR.KmlAPI,params:{}},gpx:{api:KR.GpxAPI,params:{}},geojson:{api:KR.GeoJsonAPI,params:{}},lokalhistoriewiki:{api:KR.WikipediaAPI,params:{url:"http://crossorigin.me/http://test.lokalhistoriewiki.no:8080/api.php",linkBase:"http://lokalhistoriewiki.no/?curid=",maxRadius:1e5}},jernbanemuseet:{api:KR.JernbanemuseetAPI,extend:!0,params:{lang:"no"}}},l=b();return{getData:e,getWithin:g,getBbox:f,getMunicipalityBounds:h,getCountyBounds:i,getItem:j,getCollection:function(a,b,c){var e=d("norvegiana");e.getCollection(a,b,c)},addApi:function(a,c,d){if(_.has(k,a))throw new Error("API with name "+a+" already exists");d=d||{},k[a]={api:c,params:d},l=b()}}},KR.API.mappers={}; /*! leaflet.knreise-markers - v0.0.0 - 2015-10-27 */!function(){"use strict";L.KNreiseMarkers={};var a="m 17.55,4.1951017 c -9.6366105,0 -17.4496113,7.4402593 -17.4496113,16.6171183 0,5.366984 4.6259821,10.878443 7.9062546,15.588509 C 13.057202,43.652706 17.55,49.004896 17.55,49.004896 c 0,0 4.461376,-5.052713 9.506171,-12.22664 3.296987,-4.688464 7.94344,-10.282935 7.94344,-15.965121 0,-9.177774 -7.813,-16.6180333 -17.449611,-16.6180333 z";L.KNreiseMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"awesome-marker",extraClasses:"",markerColor:"#ff0000"},initialize:function(a){return a=L.Util.setOptions(this,a)},createIcon:function(b){var c,d;return c=b&&"DIV"===b.tagName?b:document.createElement("div"),d=this.options,c.innerHTML='',this._setIconStyles(c,"icon"),this._setIconStyles(c,"icon-"+d.markerColor),c},_setIconStyles:function(a,b){var c,d=this.options,e=L.point(d["shadow"===b?"shadowSize":"iconSize"]);c="shadow"===b?L.point(d.shadowAnchor||d.iconAnchor):L.point(d.iconAnchor),!c&&e&&(c=e.divideBy(2,!0)),a.className="awesome-marker-"+b+" "+d.className,c&&(a.style.marginLeft=-c.x+"px",a.style.marginTop=-c.y+"px"),e&&(a.style.width=e.x+"px",a.style.height=e.y+"px")},createShadow:function(){var a;return a=document.createElement("div"),this._setIconStyles(a,"shadow"),a}}),L.KNreiseMarkers.icon=function(a){return new L.KNreiseMarkers.Icon(a)}}(); L.Control.Sidebar=L.Control.extend({includes:L.Mixin.Events,options:{closeButton:true,position:"left",autoPan:true},initialize:function(placeholder,options){L.setOptions(this,options);var content=L.DomUtil.get(placeholder);content.parentNode.removeChild(content);this._contentContainer=L.DomUtil.create("div","sidebar-content",content);var l="leaflet-";var container=this._container=L.DomUtil.create("div",l+"sidebar "+this.options.position);L.DomUtil.addClass(content,l+"control");container.appendChild(content);if(this.options.closeButton){var close=this._closeButton=L.DomUtil.create("a","close",container);close.innerHTML="×"}},addTo:function(map){var container=this._container;var content=this._contentContainer;if(this.options.closeButton){var close=this._closeButton;L.DomEvent.on(close,"click",this.hide,this)}L.DomEvent.on(container,"transitionend",this._handleTransitionEvent,this).on(container,"webkitTransitionEnd",this._handleTransitionEvent,this);var controlContainer=map._controlContainer;controlContainer.insertBefore(container,controlContainer.firstChild);this._map=map;var stop=L.DomEvent.stopPropagation;L.DomEvent.on(content,"click",stop).on(content,"mousedown",stop).on(content,"touchstart",stop).on(content,"dblclick",stop).on(content,"mousewheel",stop).on(content,"MozMousePixelScroll",stop);return this},removeFrom:function(map){this.hide();var content=this._contentContainer;var controlContainer=map._controlContainer;controlContainer.removeChild(this._container);this._map=null;var stop=L.DomEvent.stopPropagation;L.DomEvent.off(content,"click",stop).off(content,"mousedown",stop).off(content,"touchstart",stop).off(content,"dblclick",stop).off(content,"mousewheel",stop).off(content,"MozMousePixelScroll",stop);L.DomEvent.off(container,"transitionend",this._handleTransitionEvent,this).off(container,"webkitTransitionEnd",this._handleTransitionEvent,this);if(this._closeButton&&this._close){var close=this._closeButton;L.DomEvent.off(close,"click",this.hide,this)}return this},isVisible:function(){return L.DomUtil.hasClass(this._container,"visible")},show:function(){if(!this.isVisible()){L.DomUtil.addClass(this._container,"visible");if(this.options.autoPan){this._map.panBy([-this.getOffset()/2,0],{duration:.5})}this.fire("show")}},hide:function(e){if(this.isVisible()){L.DomUtil.removeClass(this._container,"visible");if(this.options.autoPan){this._map.panBy([this.getOffset()/2,0],{duration:.5})}this.fire("hide")}if(e){L.DomEvent.stopPropagation(e)}},toggle:function(){if(this.isVisible()){this.hide()}else{this.show()}},getContainer:function(){return this._contentContainer},getCloseButton:function(){return this._closeButton},setContent:function(content){this.getContainer().innerHTML=content;return this},getOffset:function(){if(this.options.position==="right"){return-this._container.offsetWidth}else{return this._container.offsetWidth}},_handleTransitionEvent:function(e){if(e.propertyName=="left"||e.propertyName=="right")this.fire(this.isVisible()?"shown":"hidden")}});L.control.sidebar=function(placeholder,options){return new L.Control.Sidebar(placeholder,options)};