Browse Source

merge products in layer groups with year selector

master
o.moresis 2 years ago
parent
commit
ccb3cf5c56
  1. 3
      public/js/annual_fisheries.js
  2. 108
      public/js/extras.js
  3. 171
      public/js/layers.js
  4. 4
      public/js/more-info.js
  5. 154
      public/js/treeview.js
  6. 1
      src/Services/PoseidonAPI.php

3
public/js/annual_fisheries.js

@ -1,5 +1,3 @@ @@ -1,5 +1,3 @@
function createPie(data, year) {
console.debug(data);
var charts = L.featureGroup();
@ -20,7 +18,6 @@ function createPie(data, year) { @@ -20,7 +18,6 @@ function createPie(data, year) {
height: 60,
colors: ['#ff0000', '#00ff00', '#0000ff', '#ff00ff']
});
//     mapL.addLayer(charts[d.FID_] ) ;
charts.addLayer(chart);
  }
}

108
public/js/extras.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
var requestsGrid;
var requestsGridlayer
var wfd;
var legends = {};
var selectedEntityGroup = null;
@ -208,63 +208,6 @@ async function getDepthOnPoint(latlng) { @@ -208,63 +208,6 @@ async function getDepthOnPoint(latlng) {
}
// function downloadStationData(stationid) {
// console.debug('stationid: ', stationid);
// if (stationid.length === 0) {
// return;
// }
// fetch(`${BASE_URL}/src/data/get_station_data.php?id=${stationid}`, {
// "credentials": "include",
// "headers": {
// "Accept": "application/zip",
// "Accept-Language": "en-US,en;q=0.5",
// "Sec-Fetch-Dest": "empty",
// "Sec-Fetch-Mode": "cors",
// "Sec-Fetch-Site": "same-origin",
// "Pragma": "no-cache",
// "Cache-Control": "no-cache"
// },
// "method": "GET",
// "mode": "cors"
// }).then(res => { return res.blob(); })
// .then((data) => {
// var a = document.createElement("a");
// a.href = window.URL.createObjectURL(data);
// a.download = "request";
// a.click();
// });
// }
// function downloadCruiseData(cruiseId) {
// if (cruiseId.length === 0) {
// return;
// }
// console.debug("CRUISE ID: ", cruiseId);
//
// fetch(`${BASE_URL}/src/data/get_cruise_data.php?id=${cruiseId}`, {
// "credentials": "include",
// "headers": {
// "Accept": "application/zip",
// "Accept-Language": "en-US,en;q=0.5",
// "Sec-Fetch-Dest": "empty",
// "Sec-Fetch-Mode": "cors",
// "Sec-Fetch-Site": "same-origin",
// "Pragma": "no-cache",
// "Cache-Control": "no-cache"
// },
// "method": "GET",
// "mode": "cors"
// }).then(res => { return res.blob(); })
// .then((data) => {
// var a = document.createElement("a");
// a.href = window.URL.createObjectURL(data);
// a.download = "request";
// a.click();
// });
// }
function getHabitat(layerCode) {
// load contours in JSON
const url = "https://ows.emodnet-seabedhabitats.eu/geoserver/emodnet_view/wms";
@ -393,32 +336,6 @@ function getProduct(layer) { @@ -393,32 +336,6 @@ function getProduct(layer) {
}
/**
* Submit a request to the server and returns the entry inserted
* @param {number} desc
* @param {number} crit
* @return {json}
*/
// function request_data(desc, crit, from, to, bodyId=null) {
// console.debug('requesting data');
// let url = BASE_URL + `/src/data/search_request_data.php?bodyid=${bodyId}&dateFrom=${from}&dateTo=${to}&criteria=${crit}`;
// fetch(url)
// .then(res => {
// return res.json();
// }).then(data => {
// db.requests.add({
// uuid: data.uuid,
// filename: data.filename
// }).then(d => {
// requestsGrid.updateConfig({
// data: data
// }).forceRender();
// });
// });
// }
function initializeLayerTree() {
pTree = new PickleTree({
c_target: 'layertree', //'maptab_treeview',
@ -436,13 +353,28 @@ function initializeLayerTree() { @@ -436,13 +353,28 @@ function initializeLayerTree() {
}
function getWFD(layerName, layerTitle) {
function getWFD(layer) {
var wmsGroup = L.layerGroup();
const layerName = layer.code;
const layerTitle = layer.title;
const legendName = layerName.split('_').slice(1,3).join('_');
const lgndUrl = BASE_URL + "/img/legends/" + legendName + ".png";
console.debug(lgndUrl);
let l;
l = L.tileLayer.wms(BASE_URL + '/geoserver/wms', { transparent: true, layers: layerName, format: 'image/png'});
l = L.tileLayer.wms(BASE_URL + '/geoserver/wms', { transparent: true, layers: layerName + layer.minSuffix, format: 'image/png'});
wmsGroup.addLayer(l);
layerControls[layerName] = L.control.slider(value => {
wmsGroup.removeLayer(l);
l = L.tileLayer.wms(BASE_URL + '/geoserver/wms', { transparent: true, layers: layerName + value, format: 'image/png'});
wmsGroup.addLayer(l);
},{
min: layer.minSuffix,
max: layer.maxSuffix,
step: 1,
value: layer.minSuffix,
logo: 'Year Selector',
}).addTo(mapL);
legends[layerName] = L.control.Legend({
position: "bottomright",
@ -457,7 +389,7 @@ function getWFD(layerName, layerTitle) { @@ -457,7 +389,7 @@ function getWFD(layerName, layerTitle) {
}]
}).addTo(mapL);
return l;
return wmsGroup;
}

171
public/js/layers.js

@ -284,170 +284,59 @@ var layersList = [ @@ -284,170 +284,59 @@ var layersList = [
leafletid: null,
code: 'greek_seagrass_meadows_v0906_espg3035',
},{
name: 'Ecological Status 2018',
code: 'wfd_eco_status_2018',
name: 'Ecological Status',
code: 'wfd_eco_status_',
composite: true,
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Ecological Status 2019',
code: 'wfd_eco_status_2019',
name: 'BMI Status',
code: 'wfd_bmi_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Ecological Status 2020',
code: 'wfd_eco_status_2020',
name: 'MA Status',
code: 'wfd_ma_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Ecological Status 2021',
code: 'wfd_eco_status_2021',
name: 'AN Status',
code: 'wfd_an_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'BMI Status 2018',
code: 'wfd_bmi_status_2018',
name: 'Chl-a Status',
code: 'wfd_chla_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'BMI Status 2019',
code: 'wfd_bmi_status_2019',
name: 'PCQI Status',
code: 'wfd_chla_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'BMI Status 2020',
code: 'wfd_bmi_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'BMI Status 2021',
code: 'wfd_bmi_status_2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'MA Status 2018',
code: 'wfd_ma_status_2018',
active: false,
format: 'image',
leafletid: null,
},{
name: 'MA Status 2019',
code: 'wfd_ma_status_2019',
active: false,
format: 'image',
leafletid: null,
},{
name: 'MA Status 2020',
code: 'wfd_ma_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'MA Status 2021',
code: 'wfd_ma_status_2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'AN Status 2018',
code: 'wfd_an_status_2018',
active: false,
format: 'image',
leafletid: null,
},{
name: 'AN Status 2019',
code: 'wfd_an_status_2019',
active: false,
format: 'image',
leafletid: null,
},{
name: 'AN Status 2020',
code: 'wfd_an_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'AN Status 2021',
code: 'wfd_an_status_2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chl-a Status 2018',
code: 'wfd_chla_status_2018',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chl-a Status 2019',
code: 'wfd_chla_status_2019',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chl-a Status 2020',
code: 'wfd_chla_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chl-a Status 2021',
code: 'wfd_chla_status_2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'PCQI Status 2018',
code: 'wfd_chla_status_2018',
active: false,
format: 'image',
leafletid: null,
},{
name: 'PCQI Status 2019',
code: 'wfd_chla_status_2019',
active: false,
format: 'image',
leafletid: null,
},{
name: 'PCQI Status 2020',
code: 'wfd_chla_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'PCQI Status 2021',
code: 'wfd_pcqi_status_2021',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chemi Status 2018',
code: 'wfd_chem_status_2018',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chem Status 2019',
code: 'wfd_chem_status_2019',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chem Status 2020',
code: 'wfd_chem_status_2020',
active: false,
format: 'image',
leafletid: null,
},{
name: 'Chem Status 2021',
code: 'wfd_chem_status_2021',
name: 'Chemi Status',
code: 'wfd_chem_status_',
minSuffix: '2018',
maxSuffix: '2021',
active: false,
format: 'image',
leafletid: null,
@ -487,7 +376,7 @@ async function layerTreeSwitch(node) { @@ -487,7 +376,7 @@ async function layerTreeSwitch(node) {
} else if (intId === 'PHPL') {
l = getWMSSeries(node.checkStatus);
} else if (intId.substr(0,3) === 'wfd') {
l = getWFD(intId, node.title);
l = getWFD(layer);
} else if (layer.format === 'image') {
l = L.tileLayer.betterWms(BASE_URL + '/geoserver/wms', { layers: intId, transparent: true, format: "image/png"});
} else {

4
public/js/more-info.js

@ -100,9 +100,6 @@ function moreInfo() { @@ -100,9 +100,6 @@ function moreInfo() {
to: calendar.endDate.toLocaleDateString()
}
});
// calendar.on('select', data => {
// console.debug('date: ', data);
// });
});
},
populateFeatureGrid(grid) {
@ -123,7 +120,6 @@ function moreInfo() { @@ -123,7 +120,6 @@ function moreInfo() {
console.debug('drawing poseidon chart...');
this.lineChart = {};
var ctx = document.getElementById('data-chart').getContext('2d');
// Alpine.store('loading', true);
console.debug('fetching...');
console.debug('params: ',this.params);
console.debug('entity group: ',this.entityGroup);

154
public/js/treeview.js

@ -368,170 +368,44 @@ const myData = [{ @@ -368,170 +368,44 @@ const myData = [{
n_parentid: 33
},{
n_id: 3311,
n_title: 'Ecological Status 2018',
code: 'wfd_eco_status_2018',
n_elements: nodeContext,
n_parentid: 331
},{
n_id: 3312,
n_title: 'Ecological Status 2019',
code: 'wfd_eco_status_2019',
n_elements: nodeContext,
n_parentid: 331
},{
n_id: 3313,
n_title: 'Ecological Status 2020',
code: 'wfd_eco_status_2020',
n_elements: nodeContext,
n_parentid: 331
},{
n_id: 3314,
n_title: 'Ecological Status 2021',
code: 'wfd_eco_status_2021',
n_title: 'Ecological Status',
code: 'wfd_eco_status_',
n_elements: nodeContext,
n_parentid: 331
},{
n_id: 3321,
n_title: 'BMI Status 2018',
code: 'wfd_bmi_status_2018',
n_elements: nodeContext,
n_parentid: 332
},{
n_id: 3322,
n_title: 'BMI Status 2019',
code: 'wfd_bmi_status_2019',
n_elements: nodeContext,
n_parentid: 332
},{
n_id: 3323,
n_title: 'BMI Status 2020',
code: 'wfd_bmi_status_2020',
n_elements: nodeContext,
n_parentid: 332
},{
n_id: 3324,
n_title: 'BMI Status 2021',
code: 'wfd_bmi_status_2021',
n_title: 'BMI Status',
code: 'wfd_bmi_status_',
n_elements: nodeContext,
n_parentid: 332
},{
n_id: 3331,
n_title: 'MA Status 2018',
code: 'wfd_ma_status_2018',
n_elements: nodeContext,
n_parentid: 333
},{
n_id: 3332,
n_title: 'MA Status 2019',
code: 'wfd_ma_status_2019',
n_elements: nodeContext,
n_parentid: 333
},{
n_id: 3333,
n_title: 'MA Status 2020',
code: 'wfd_ma_status_2020',
n_elements: nodeContext,
n_parentid: 333
},{
n_id: 3334,
n_title: 'MA Status 2021',
code: 'wfd_ma_status_2021',
n_title: 'MA Status',
code: 'wfd_ma_status_',
n_elements: nodeContext,
n_parentid: 333
},{
n_id: 3341,
n_title: 'AN Status 2018',
code: 'wfd_an_status_2018',
n_elements: nodeContext,
n_parentid: 334
},{
n_id: 3342,
n_title: 'AN Status 2019',
code: 'wfd_an_status_2019',
n_elements: nodeContext,
n_parentid: 334
},{
n_id: 3343,
n_title: 'AN Status 2020',
code: 'wfd_an_status_2020',
n_elements: nodeContext,
n_parentid: 334
},{
n_id: 3344,
n_title: 'AN Status 2021',
code: 'wfd_an_status_2021',
n_title: 'AN Status',
code: 'wfd_an_status_',
n_elements: nodeContext,
n_parentid: 334
},{
n_id: 3351,
n_title: 'Chl-a Status 2018',
code: 'wfd_chla_status_2018',
n_elements: nodeContext,
n_parentid: 335
},{
n_id: 3352,
n_title: 'Chl-a Status 2019',
code: 'wfd_chla_status_2019',
n_elements: nodeContext,
n_parentid: 335
},{
n_id: 3353,
n_title: 'Chl-a Status 2020',
code: 'wfd_chla_status_2020',
n_elements: nodeContext,
n_parentid: 335
},{
n_id: 3354,
n_title: 'Chl-a Status 2021',
code: 'wfd_chla_status_2021',
n_title: 'Chl-a Status',
code: 'wfd_chla_status_',
n_elements: nodeContext,
n_parentid: 335
},{
n_id: 3361,
n_title: 'PCQI Status 2018',
code: 'wfd_chla_status_2018',
n_elements: nodeContext,
n_parentid: 336
},{
n_id: 3362,
n_title: 'PCQI Status 2019',
code: 'wfd_chla_status_2019',
n_elements: nodeContext,
n_parentid: 336
},{
n_id: 3363,
n_title: 'PCQI Status 2020',
code: 'wfd_chla_status_2020',
n_elements: nodeContext,
n_parentid: 336
},{
n_id: 3364,
n_title: 'PCQI Status 2021',
code: 'wfd_pcqi_status_2021',
n_title: 'PCQI Status',
code: 'wfd_chla_status_',
n_elements: nodeContext,
n_parentid: 336
},{
n_id: 3371,
n_title: 'Chemi Status 2018',
code: 'wfd_chem_status_2018',
n_elements: nodeContext,
n_parentid: 337
},{
n_id: 3372,
n_title: 'Chem Status 2019',
code: 'wfd_chem_status_2019',
n_elements: nodeContext,
n_parentid: 337
},{
n_id: 3373,
n_title: 'Chem Status 2020',
code: 'wfd_chem_status_2020',
n_elements: nodeContext,
n_parentid: 337
},{
n_id: 3374,
n_title: 'Chem Status 2021',
code: 'wfd_chem_status_2021',
n_title: 'Chemi Status',
code: 'wfd_chem_status_',
n_elements: nodeContext,
n_parentid: 337
}

1
src/Services/PoseidonAPI.php

@ -55,6 +55,7 @@ class PoseidonAPI extends API { @@ -55,6 +55,7 @@ class PoseidonAPI extends API {
$params = ["ATMS"]; // debugging
$data = array(
"param__pname__in" => implode(',', $params),
"ordering" => 'dt'
);
$this->headers["Authorization"] = "Bearer {$this->accessToken}";

Loading…
Cancel
Save