Ero sivun ”Widget:Ol3MuniMap” versioiden välillä
Järvi-meriwikistä
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”) |
|||
(14 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
<includeonly> | <includeonly> | ||
− | <link rel="stylesheet" href=" | + | <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=" | + | <script src="/scripts/ol3/ol.js"></script> |
− | <script src=" | + | <script src="/scripts/proj4js/dist/proj4.js"></script> |
− | <script src=" | + | <script src="/scripts/jwol3js/jwol3.js"></script> |
− | <link rel="stylesheet" href=" | + | <link rel="stylesheet" href="/scripts/ol-ext/dist/ol-ext.min.css" type="text/css"> |
− | <script src=" | + | <script src="/scripts/ol-ext/dist/ol-ext.min.js"></script> |
− | <link rel="stylesheet" href=" | + | <link rel="stylesheet" href="/scripts/ol-ext/overlay/popupoverlay.css" /> |
− | <link rel="stylesheet" href=" | + | <link rel="stylesheet" href="/scripts/ol-ext/overlay/popupoverlay.anim.css" /> |
<div class="jwMapContainer" style="height:<!--{$height|default:500|escape:'html'}-->px" > | <div class="jwMapContainer" style="height:<!--{$height|default:500|escape:'html'}-->px" > | ||
Rivi 18: | Rivi 18: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
+ | |||
//global memory for widget instance | //global memory for widget instance | ||
var <!--{$id|default:CommonObsMap|escape:'html'}-->_memo = { 'SitesO': {}, 'TypesO': {}, 'obsTypeToShow': '' }; | var <!--{$id|default:CommonObsMap|escape:'html'}-->_memo = { 'SitesO': {}, 'TypesO': {}, 'obsTypeToShow': '' }; | ||
− | + | function <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() { | |
+ | if ( typeof window.jQuery == 'undefined' ) { | ||
+ | setTimeout( function(){ <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() }, 300); | ||
+ | } else { | ||
+ | <!--{$id|default:CommonObsMap|escape:'html'}-->_func(); | ||
+ | } | ||
+ | } | ||
+ | setTimeout( function(){ <!--{$id|default:CommonObsMap|escape:'html'}-->_jQueryTest() }, 300); | ||
function <!--{$id|default:CommonObsMap|escape:'html'}-->_func() { | function <!--{$id|default:CommonObsMap|escape:'html'}-->_func() { | ||
Rivi 36: | Rivi 44: | ||
var base = '<!--{$base|default:mmlTausta|escape:'html'}-->'; | var base = '<!--{$base|default:mmlTausta|escape:'html'}-->'; | ||
− | var layersArr = []; | + | function gotSeaVPDs(request) { |
+ | |||
+ | var layersArr = []; | ||
− | + | layersArr.push( { | |
− | + | 'id': 'muni', | |
− | + | 'type': 'anyrest', | |
− | + | 'name': 'Kunta', | |
− | + | 'restUrl': '//paikkatieto.ymparisto.fi/arcgis/rest/services/sykemaps/GISAineistot2/MapServer/0/query', | |
− | + | 'search': "KuntaNimi = '" + muni + "'", | |
− | + | 'selectable': false, | |
− | + | 'zoomToExtent': true, | |
− | + | 'bbox': false, | |
− | + | 'fillColor': 'rgba( 0, 0, 0, 0 )', | |
− | + | 'strokeColor': 'rgba( 200, 100, 100, 0.5 )', | |
+ | 'strokeWidth': 5 | ||
+ | //'attribution': '<a href="//wwwp2.ymparisto.fi/kayttoehdot.html">Ympäristöhallinnon paikkatietoaineistot</a>', | ||
+ | }); | ||
− | + | if ( typeof request.query.results != 'undefined' ) { | |
− | 'type': 'jwanypage', | + | |
− | + | var vpdsearchA = []; | |
− | + | ||
− | + | for ( var r in request.query.results ) { | |
− | + | vpdsearchA.push( "VPDTunnus = '" + request.query.results[ r ].printouts.VPDTunnus[0] + "'" ); | |
− | + | } | |
− | + | ||
− | + | if ( vpdsearchA.length > 0 ) { | |
− | + | ||
− | + | layersArr.push( { | |
− | + | 'id': 'seavpd', | |
− | + | 'type': 'anyrest', | |
− | + | 'name': 'Merialueet', | |
− | + | 'restUrl': '//paikkatieto.ymparisto.fi/arcgis/rest/services/INSPIRE/SYKE_AlueidenHallintaJaRajoitukset1/MapServer/3/query', | |
− | + | 'search': vpdsearchA.join( ' OR ' ), | |
− | + | 'selectable': true, | |
− | + | 'zoomToExtent': false, | |
− | + | 'bbox': false, | |
− | + | //'attribution': '<a href="//wwwp2.ymparisto.fi/kayttoehdot.html">Ympäristöhallinnon paikkatietoaineistot</a>', | |
− | + | }); | |
− | + | } | |
− | + | ||
− | ' | + | } |
+ | |||
+ | layersArr.push( { | ||
+ | 'type': 'jwanypage', | ||
+ | 'name': 'Järvet', | ||
+ | 'search': '[[Luokka:Järvi]][[Kunta::' + page + ']]', | ||
+ | //'opacitySlider': true, | ||
+ | //'showLabels': false, | ||
+ | 'selectable': true, | ||
+ | 'clustered': true, | ||
+ | 'pointRadius': 5, | ||
+ | //'maxResolution': 500, | ||
+ | 'label': 'J', | ||
+ | //'zoomToExtent': false | ||
+ | } ); | ||
+ | |||
+ | layersArr.push( { | ||
+ | 'type': 'sitesNobses', | ||
+ | 'name': 'Paikat ja havainnot', | ||
+ | //'siteSearch': '[[Kunta::' + page + ']]', | ||
+ | 'obsSearch': '[[Kunta::' + page + ']][[obsCode::ice||snow||temp||alg||img]]', | ||
+ | 'obsDays': 7, | ||
+ | //'attribution': 'Havainnot: Järvi-meriwiki', | ||
+ | 'opacitySlider': false, | ||
+ | 'selectable': true, | ||
+ | 'zoomToExtent': false | ||
+ | }); | ||
+ | |||
+ | //layersArr.push({ 'type': 'geoloc', 'name': 'Sijaintisi', 'show': true, 'center': false, 'zoom': 12, 'track': false }); | ||
+ | |||
+ | // do the base map with these settings | ||
+ | var map = ol3_jwMakeMap({ | ||
+ | 'container': '<!--{$id|default:CommonObsMap|escape:'html'}-->_container', | ||
+ | 'base': base, | ||
+ | 'lon': lon, | ||
+ | 'lat': lat, | ||
+ | 'zoom': zoom, | ||
+ | 'layers': layersArr, | ||
+ | 'memo': memo | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | var searchStr = 'action=ask&query=[[Luokka:Merialue]][[Kunta::' + page + ']]'; | ||
+ | searchStr += encodeURI('|?VPDTunnus'); | ||
+ | searchStr += '&format=json'; | ||
+ | |||
+ | jQuery.ajax({ | ||
+ | type: 'GET', | ||
+ | url: queryApi, | ||
+ | data: searchStr, | ||
+ | success: gotSeaVPDs, | ||
+ | dataType: 'jsonp', | ||
+ | cache: true | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
</script> | </script> | ||
</includeonly> | </includeonly> |