Skip to content

Commit

Permalink
extend detail view for ra (ref #135)
Browse files Browse the repository at this point in the history
  • Loading branch information
atlefren committed Nov 27, 2015
1 parent 4ff7777 commit 2fb6835
Show file tree
Hide file tree
Showing 27 changed files with 233 additions and 69 deletions.
5 changes: 1 addition & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
"esri2geo": "https://github.com/calvinmetcalf/esri2geo.git",
"L.TileLayer.Kartverket": "1.0.2",
"Leaflet-MiniMap": "https://github.com/Norkart/Leaflet-MiniMap.git#~2.2.0",
"KNreiseAPI": "1.7.19",
"KNreiseAPI": "1.7.21",
"cesium-minimap": "0.0.2",
"cilogi-marker": "https://github.com/cilogi/cilogi-marker.git",
"leaflet.knreise-markers": "https://github.com/knreise/Leaflet.knreise-markers.git",
"leaflet-draw": "~0.2.4",
"Leaflet.TileLayer.PouchDBCached": "https://github.com/MazeMap/Leaflet.TileLayer.PouchDBCached.git#0.1.0",
"fontawesome": "4.4.0"
},
"resolutions": {
"fontawesome": "4.4.0"
}
}
10 changes: 5 additions & 5 deletions bower_components/KNreiseAPI/.bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "KNreiseAPI",
"version": "1.7.19",
"version": "1.7.21",
"description": "Api wrapper for KNreise",
"authors": [
"Atle Frenvik Sveen <[email protected]>"
Expand All @@ -26,14 +26,14 @@
"proj4": "~2.3.6"
},
"homepage": "https://github.com/knreise/KNReiseAPI",
"_release": "1.7.19",
"_release": "1.7.21",
"_resolution": {
"type": "version",
"tag": "1.7.19",
"commit": "572513f306c0ce282b06f4f52a1a77957ba4fefc"
"tag": "1.7.21",
"commit": "de107ba0332076fc2cf54d2017b698cd6b787045"
},
"_source": "git://github.com/knreise/KNReiseAPI.git",
"_target": "1.7.19",
"_target": "1.7.21",
"_originalSource": "KNreiseAPI",
"_direct": true
}
2 changes: 1 addition & 1 deletion bower_components/KNreiseAPI/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "KNreiseAPI",
"version": "1.7.19",
"version": "1.7.21",
"description": "Api wrapper for KNreise",
"authors": [
"Atle Frenvik Sveen <[email protected]>"
Expand Down
134 changes: 99 additions & 35 deletions bower_components/KNreiseAPI/dist/KNreiseAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,13 @@ KR.SparqlAPI = function (apiName, options) {
return KR.Util.createGeoJSONFeatureFromGeom(collection, {});
}


function _parseEnkeltminnePoly(response, errorCallback) {
var bindings = response.results.bindings;
return bindings;
}


function _sendQuery(query, parse, callback, errorCallback) {
var params = {
'default-graph-uri': '',
Expand All @@ -1372,23 +1379,31 @@ KR.SparqlAPI = function (apiName, options) {
return;
}

var query = 'select distinct ?id ?name ?description ?loccatlabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link {' +
' ?id a ?type ;' +
' rdfs:label ?name ;' +
' <https://data.kulturminne.no/askeladden/schema/beskrivelse> ?description ;' +
' <https://data.kulturminne.no/askeladden/schema/lokalitetskategori> ?loccat ;' +
' ?p <https://data.kulturminne.no/difi/geo/kommune/' + dataset.kommune + '> ;' +
' <https://data.kulturminne.no/askeladden/schema/geo/point/etrs89> ?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 <https://data.kulturminne.no/bildearkivet/schema/lokalitet> ?id .' +
' ?picture <https://data.kulturminne.no/schema/source-link> ?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)' +
' }';
var query = 'select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ' +
' ?id a ?type ; ' +
' rdfs:label ?name ; ' +
' <https://data.kulturminne.no/askeladden/schema/beskrivelse> ?description ; ' +
' <https://data.kulturminne.no/askeladden/schema/lokalitetskategori> ?loccat ; ' +
' <https://data.kulturminne.no/askeladden/schema/lokalitetsart> ?locart ; ' +
' <https://data.kulturminne.no/askeladden/schema/AnsvarligOrganisasjon> ?org ; ' +
' ?p <https://data.kulturminne.no/difi/geo/kommune/' + dataset.kommune + '> ; ' +
' <https://data.kulturminne.no/askeladden/schema/geo/point/etrs89> ?point . ' +
' optional { ?loccat rdfs:label ?loccatlabel .} ' +
' optional { ?locart rdfs:label ?locartlabel .} ' +
' optional { ?org rdfs:label ?orglabel .} ' +
' 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 <https://data.kulturminne.no/bildearkivet/schema/lokalitet> ?id . ' +
' ?picture <https://data.kulturminne.no/schema/source-link> ?link . ' +
' ?picture rdfs:label ?picturelabel . ' +
' ?picture dc:description ?picturedescription . ' +
' ?picture <https://data.kulturminne.no/bildearkivet/schema/license> ?picturelicence . ' +
' 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)' +
'} ';

if (dataset.filter) {
query += ' ' + dataset.filter;
}
Expand All @@ -1410,24 +1425,31 @@ KR.SparqlAPI = function (apiName, options) {
fylke = '0' + fylke;
}

var query = 'select ?id ?name ?description ?loccatlabel (SAMPLE(?point) as ?point) ?img ?thumbnail ?url as ?link {' +
' ?id a ?type .' +
' ?id rdfs:label ?name .' +
' ?id <https://data.kulturminne.no/askeladden/schema/i-kommune> ?kommune .' +
' ?id <https://data.kulturminne.no/askeladden/schema/beskrivelse> ?description .' +
' ?id <https://data.kulturminne.no/askeladden/schema/lokalitetskategori> ?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 <https://data.kulturminne.no/askeladden/schema/geo/point/etrs89> ?point .' +
' optional {' +
' ?picture <https://data.kulturminne.no/bildearkivet/schema/lokalitet> ?id .' +
' ?picture <https://data.kulturminne.no/schema/source-link> ?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, "^.*' + fylke + '[0-9]{2}") .';
var query = ' select distinct ?id ?name ?description ?loccatlabel ?locartlabel ?orglabel ?img ?thumbnail (SAMPLE(?point) as ?point) ?url as ?link ?picture ?picturelabel ?picturedescription ?picturelicence { ' +
' ?id a ?type ; ' +
' rdfs:label ?name ; ' +
' <https://data.kulturminne.no/askeladden/schema/beskrivelse> ?description ; ' +
' <https://data.kulturminne.no/askeladden/schema/lokalitetskategori> ?loccat ; ' +
' <https://data.kulturminne.no/askeladden/schema/lokalitetsart> ?locart ; ' +
' <https://data.kulturminne.no/askeladden/schema/AnsvarligOrganisasjon> ?org ; ' +
' <https://data.kulturminne.no/askeladden/schema/i-kommune> ?kommune ; ' +
' <https://data.kulturminne.no/askeladden/schema/geo/point/etrs89> ?point . ' +
' optional { ?loccat rdfs:label ?loccatlabel .} ' +
' optional { ?locart rdfs:label ?locartlabel .} ' +
' optional { ?org rdfs:label ?orglabel .} ' +
' 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 <https://data.kulturminne.no/bildearkivet/schema/lokalitet> ?id . ' +
' ?picture <https://data.kulturminne.no/schema/source-link> ?link . ' +
' ?picture rdfs:label ?picturelabel . ' +
' ?picture dc:description ?picturedescription . ' +
' ?picture <https://data.kulturminne.no/bildearkivet/schema/license> ?picturelicence . ' +
' 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) ' +
' } ' +
' FILTER regex(?kommune, "^.*' + fylke + '[1-9]{2}") . ';

if (dataset.filter) {
query += ' ' + dataset.filter;
Expand All @@ -1447,6 +1469,19 @@ KR.SparqlAPI = function (apiName, options) {
'}';
}

function _enkeltminneForLokalitetQuery(lokalitet) {
return 'SELECT ?enk as ?id ?name ?desc as ?content ?area as ?omraade ?enkcatlabel ' +
'where { ' +
'?enk a <https://data.kulturminne.no/askeladden/schema/Enkeltminne> . ' +
'?enk rdfs:label ?name . ' +
'?enk <https://data.kulturminne.no/askeladden/schema/i-lokalitet> <' + lokalitet.trim() + '> . ' +
'?enk <https://data.kulturminne.no/askeladden/schema/beskrivelse> ?desc . ' +
'?enk <https://data.kulturminne.no/askeladden/schema/geo/area/etrs89> ?area . ' +
'?enk <https://data.kulturminne.no/askeladden/schema/enkeltminnekategori> ?enkcat . ' +
'?enkcat rdfs:label ?enkcatlabel . ' +
'} ';
}

function _polyForLokalitet(dataset, callback, errorCallback) {

var lokalitet = [];
Expand All @@ -1471,6 +1506,33 @@ KR.SparqlAPI = function (apiName, options) {
});
}

function _enkeltminnerForLokalitet(dataset, callback, errorCallback) {

var lokalitet = [];
if (_.isArray(dataset.lokalitet)) {
lokalitet = dataset.lokalitet;
} else {
lokalitet.push(dataset.lokalitet);
}


var features = [];
var finished = _.after(lokalitet.length, function () {
callback(KR.Util.createFeatureCollection(features));
});

_.each(lokalitet, function (lok) {
_sendQuery(_enkeltminneForLokalitetQuery(lok), _parseResponse, function (geoJson) {
var featuresForLok = _.map(geoJson.features, function (f) {
f.properties.lokalitet = lok;
return f;
})
features = features.concat(featuresForLok);
finished();
}, errorCallback);
});
}

function getData(dataset, callback, errorCallback, options) {
dataset = _.extend({}, {geomType: 'point'}, dataset);
if (dataset.kommune) {
Expand All @@ -1481,6 +1543,8 @@ KR.SparqlAPI = function (apiName, options) {
_sendQuery(query, _parseResponse, callback, errorCallback);
} else if (dataset.lokalitet && dataset.type === 'lokalitetpoly') {
_polyForLokalitet(dataset, callback, errorCallback);
} else if (dataset.lokalitet && dataset.type === 'enkeltminner') {
_enkeltminnerForLokalitet(dataset, callback, errorCallback);
} else if (dataset.sparqlQuery) {
_sendQuery(dataset.sparqlQuery, _parseResponse, callback, errorCallback);
} else {
Expand Down
4 changes: 2 additions & 2 deletions bower_components/KNreiseAPI/dist/KNreiseAPI.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bower_components/KNreiseAPI/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "KNreiseAPI",
"version": "1.7.19",
"version": "1.7.21",
"description": "Api wrapper for KNreise",
"main": "index.js",
"scripts": {
Expand Down
18 changes: 18 additions & 0 deletions common/css/L.Knreise.Control.Sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,22 @@

.wikipedia-content h2 {
font-size: 18px;
}

.image.with-caption {
display: inline-block;
background: #f5f5f5;
margin-bottom: 15px;
}
.image.with-caption p {
margin: 0;
padding-bottom: 0.5em;
color: #999;
font-size: 90%;
padding-left: 0.5em;
padding-right: 0.5em;
}

.image.with-caption .thumbnail {
margin-bottom: 5px;
}
7 changes: 6 additions & 1 deletion demonstratorer/2verdenskrig.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/akerselva.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/config_3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/dovre.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/flyktningeruta.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/folkemusikk.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
7 changes: 6 additions & 1 deletion demonstratorer/foto.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,14 @@ <h3><%= title %></h3>
<h3><%= name %></h3>

<% if (img) { %>
<img class="fullwidth img-thumbnail" src="<%= img %>" />
<div class="image with-caption">

<img class="thumbnail fullwidth" src="<%= img %>" />
<p><%= picturelabel %> - <%= picturedescription %> (<a href="<%= picturelicence%>" target="_blank">Lisens</a>)</p>
</div>
<% } %>


<p><%= description %></p>

<table class="sidebar-table">
Expand Down
Loading

0 comments on commit 2fb6835

Please sign in to comment.