Ero sivun ”Widget:Ol3RiverMap” versioiden välillä
Järvi-meriwikistä
(Ak: Uusi sivu: <includeonly> <link rel="stylesheet" href="/scripts/ol3/ol.css" type="text/css"> <script src="//cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Elemen...) |
p (Tekstin korvaus – ”//cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL” muotoon ”https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js”) |
||
(29 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 2: | Rivi 2: | ||
<link rel="stylesheet" href="/scripts/ol3/ol.css" type="text/css"> | <link rel="stylesheet" href="/scripts/ol3/ol.css" type="text/css"> | ||
− | <script src="// | + | <script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js"></script> |
<script src="/scripts/ol3/ol.js"></script> | <script src="/scripts/ol3/ol.js"></script> | ||
Rivi 41: | Rivi 41: | ||
function gotCoords(request) { | function gotCoords(request) { | ||
− | + | ||
− | for (var x in request.query.results) { | + | for ( var x in request.query.results ) { |
var resultItem = request.query.results[x].printouts; break; | var resultItem = request.query.results[x].printouts; break; | ||
} | } | ||
− | + | var vpdArr = []; | |
− | + | for ( var j in resultItem.VPDTunnus ) { | |
− | + | vpdArr.push( "VPDTunnus='" + resultItem.VPDTunnus[j] + "'" ); | |
− | + | } | |
− | var | + | |
− | + | var vesalArr = []; | |
+ | var vesalIdArr = []; | ||
+ | vesalArr.push( decodeURI(page) ); | ||
+ | for ( var j in resultItem.Vesistöalue ) { | ||
+ | vesalArr.push( resultItem.Vesistöalue[j].fulltext ); | ||
+ | vesalIdArr.push( "Jako3Tunnus LIKE '" + resultItem.Vesistöalue[j].fulltext.split( /\(|\)/ )[1] + "%'" ); | ||
+ | } | ||
+ | |||
var base = 'mmlTausta'; | var base = 'mmlTausta'; | ||
− | + | ||
− | + | var layersArr = []; | |
− | |||
− | |||
− | + | layersArr.push({ | |
+ | 'type': 'anyrest', | ||
+ | 'restUrl': '//paikkatieto.ymparisto.fi/arcgis/rest/services/INSPIRE/SYKE_Hydrografia/MapServer/4/query', | ||
+ | 'name': 'Vesistöalue', | ||
+ | 'search': vesalIdArr.join( ' OR ' ), | ||
+ | 'attribution': '<a href="//wwwp2.ymparisto.fi/kayttoehdot.html">Ympäristöhallinnon paikkatietoaineistot</a>', | ||
+ | 'visible': true, | ||
+ | 'fillColor': 'rgba( 0, 0, 255, 0.25 )', | ||
+ | 'strokeWidth': 1, | ||
+ | 'strokeColor': 'rgba( 0, 0, 255, 0.5 )', | ||
+ | 'showLabels': false, | ||
+ | 'selectable': true, | ||
+ | 'zoomToExtent': true | ||
+ | }); | ||
layersArr.push({ | layersArr.push({ | ||
'type': 'anyrest', | 'type': 'anyrest', | ||
− | 'restUrl': ' | + | 'restUrl': '//paikkatieto.ymparisto.fi/arcgis/rest/services/INSPIRE/SYKE_AlueidenHallintaJaRajoitukset1/MapServer/1/query', |
'name': 'Joki', | 'name': 'Joki', | ||
− | 'search': | + | 'search': vpdArr.join( ' OR ' ), |
− | + | 'attribution': '<a href="//wwwp2.ymparisto.fi/kayttoehdot.html">Ympäristöhallinnon paikkatietoaineistot</a>', | |
'visible': true, | 'visible': true, | ||
− | ' | + | 'fillColor': 'rgba( 255, 0, 0, 0.75 )', |
+ | 'strokeWidth': 8, | ||
+ | 'strokeColor': 'rgba( 0, 0, 255, 0.8 )', | ||
'showLabels': false, | 'showLabels': false, | ||
'selectable': false, | 'selectable': false, | ||
− | 'zoomToExtent': | + | 'zoomToExtent': false |
}); | }); | ||
− | + | ||
+ | console.log( "[[Alue::" + vesalArr.join( '||' ) + "]]" ); | ||
+ | |||
layersArr.push({ | layersArr.push({ | ||
'type': 'sitesNobses', | 'type': 'sitesNobses', | ||
'name': 'Paikat ja havainnot', | 'name': 'Paikat ja havainnot', | ||
− | 'siteSearch': "[[Alue::" + | + | 'siteSearch': "[[Alue::" + vesalArr.join( '||' ) + "]]", |
− | 'obsSearch': "[[Alue::" + | + | 'obsSearch': "[[Alue::" + vesalArr.join( '||' ) + "]]", |
'obsDays': 10, | 'obsDays': 10, | ||
− | + | 'attribution': 'Paikat ja havainnot: Järvi-meriwiki', | |
'opacitySlider': false, | 'opacitySlider': false, | ||
'selectable': true, | 'selectable': true, | ||
Rivi 91: | Rivi 113: | ||
'container': '<!--{$id|default:CommonObsMap|escape:'html'}-->_container', | 'container': '<!--{$id|default:CommonObsMap|escape:'html'}-->_container', | ||
'base': base, | 'base': base, | ||
− | + | 'lon': 65, | |
− | + | 'lat': 25, | |
− | + | 'zoom': 6, | |
'layers': layersArr, | 'layers': layersArr, | ||
'memo': memo | 'memo': memo | ||
Rivi 102: | Rivi 124: | ||
var searchStr = 'action=ask&query=[[' + page + ']]'; | var searchStr = 'action=ask&query=[[' + page + ']]'; | ||
− | searchStr += encodeURI('|? | + | searchStr += encodeURI('|?VPDTunnus|?Vesistöalue'); |
searchStr += '&format=json'; | searchStr += '&format=json'; | ||