Skip to content

Commit

Permalink
Bringing fixes to productions (#2585)
Browse files Browse the repository at this point in the history
* fix: order of async fetched dataInfo

* Integration of eox-map for the map widget (#2573)

* feat: initial eox-map swapping of ol

* chore: trying out exporting map config state in iframe text

* chore working on getting xyz layers working

* chore: changed update function

* fix: time update for XYZ layers

* chore: fix

* feat: implemented config export feature for map

* feat: added different export types for eox-map story blocks

* chore: upgrading story and jsonform packages, using new markdown placeholder for story editor

* chore: removed storytelling example

* chore: adding unique identifiers to data layers

* feat: exporting only layers without group as it has issues with eox-map, also simplifies code block; updated eox-map version

* chore: adding export of opacity in config when it is not set to 1

* chore: removing log message

---------

Co-authored-by: Lubomir Dolezal <lubojr@seznam.cz>

* fix: MCD config match

* fix: using type comparison to make sure correct types are identified for export function (#2583)

* chore: adapt config for E13c , E13b tri detections from geodb

* fix: injecting previosly used tooltip style into shadow dom of eox-map (#2584)

* chore: adapted tooltip style, updated format import and comparison for olexport

---------

Co-authored-by: Lubomir Dolezal <lubojr@seznam.cz>
  • Loading branch information
santilland and lubojr authored May 28, 2024
1 parent 869745e commit b1b0369
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 35 deletions.
14 changes: 7 additions & 7 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"luxon": "^1.28.1",
"marked": "^4.0.10",
"medium-zoom": "^1.0.6",
"ol": "^9.1.0",
"ol": "^9.2.4",
"ol-mapbox-style": "^11.0.0",
"proj4": "^2.8.0",
"regl": "^2.1.0",
Expand Down
61 changes: 48 additions & 13 deletions app/src/components/OLExportButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ import {
} from 'vuex';
import { getUid } from 'ol/util';
import { toLonLat } from 'ol/proj';
import LayerGroup from 'ol/layer/Group';
import TileLayer from 'ol/layer/Tile';
import { TileWMS, WMTS, XYZ } from 'ol/source';
import VectorSource from 'ol/source/Vector';
import { GeoJSON, MVT, WKB } from 'ol/format';
export default {
mixins: [dialogMixin],
Expand Down Expand Up @@ -170,13 +175,11 @@ Text describing the current step of the tour and why it is interesting what the
// Extract completely flat layers array without groups
const layers = [];
layerArray.map((l) => {
if (l.constructor.name.includes('Group')) {
if (l instanceof LayerGroup) {
layers.push(this.extractLayerConfig(l.getLayersArray()));
} else if (l.constructor.name.includes('STACLayer')) {
layers.push(l.get('_jsonDefinition'));
} else {
} else if (l instanceof TileLayer) {
const layerConfig = {
type: l.constructor.name.replace('Layer', ''),
type: 'Tile',
properties: {
id: l.get('configId') ? l.get('configId') : getUid(l),
},
Expand All @@ -185,28 +188,60 @@ Text describing the current step of the tour and why it is interesting what the
const olsource = l.getSource();
// only export visible layers
if (olsource && l.isVisible()) {
// Find correct type
let foundType;
if (olsource instanceof XYZ) {
foundType = 'XYZ';
}
if (olsource instanceof TileWMS) {
foundType = 'TileWMS';
}
if (olsource instanceof VectorSource) {
foundType = 'VectorSource';
}
if (olsource instanceof WMTS) {
foundType = 'WMTS';
}
// Extract source config
const source = {
type: l.getSource().constructor.name.replace('Source', ''),
type: foundType,
};
if (['XYZ', 'TileWMS', 'WMS'].includes(olsource.constructor.name)) {
if (['XYZ', 'TileWMS', 'WMTS'].includes(foundType)) {
if ('url' in olsource) {
source.url = olsource.url;
} else if ('urls' in olsource) {
source.urls = olsource.urls;
}
} else if (olsource.constructor.name === 'VectorSource') {
} else if (foundType === 'VectorSource') {
source.url = olsource.getUrl();
source.format = olsource.getFormat()?.constructor.name;
let vsf;
const olformat = olsource.getFormat();
if (olformat instanceof GeoJSON) {
vsf = 'GeoJSON';
}
if (olformat instanceof MVT) {
vsf = 'MVT';
}
if (olformat instanceof WKB) {
vsf = 'WKB';
}
if (vsf) {
source.format = vsf;
}
}
// Extract possible other configuration options
if (['TileWMS', 'WMS'].includes(olsource.constructor.name)) {
if (['TileWMS'].includes(foundType)) {
source.params = olsource.getParams();
source.serverType = olsource.serverType_;
}
if (olsource.constructor.name === 'VectorSource') {
// TODO: the getStyle function does not return the applied style as described in OL docs
layerConfig.style = ''; // l.getStyle();
if (['WMTS'].includes(foundType)) {
source.layer = olsource.getLayer();
source.format = olsource.getFormat();
source.matrixSet = olsource.getMatrixSet();
// TODO: i think we also need to have information on tilegrid here
}
if (foundType === 'VectorSource') {
layerConfig.style = l.getStyle();
}
if (l.getOpacity() !== 1) {
layerConfig.opacity = l.getOpacity();
Expand Down
27 changes: 27 additions & 0 deletions app/src/components/map/MapOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ export default {
});
map.addOverlay(overlay);
this.overlay = overlay;
// TODO: i imagine we don't really want to be injecting the style but this is
// the solution that seemed to work best right now
const style = document.createElement('style');
style.innerHTML = `.tooltip {
padding: 1px 10px 1px 10px;
margin: 0px;
border-radius: 5px;
position: relative;
font-size: 14px;
box-shadow: none !important;
background: rgba(0, 0, 0, 0.8) !important;
color: #FFFFFF !important;
}
.tooltip:after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 0;
border: 10px solid transparent;
border-top-color: rgba(0, 0, 0, 0.6);
border-bottom: 0;
margin-left: -10px;
margin-bottom: -10px;
}`;
this.$parent.$refs.mapContainer.shadowRoot.appendChild(style);
},
methods: {},
beforeDestroy() {
Expand Down
15 changes: 1 addition & 14 deletions app/src/config/trilateral.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,9 @@ export const layerNameMapping = Object.freeze({
};
return mapping[eoID];
},
features: {
name: 'Ship detections',
dateFormatFunction: (date) => DateTime.fromISO(date).toFormat('yyyy_MM_dd'),
url: 'https://8ib71h0627.execute-api.us-east-1.amazonaws.com/v1/detections/ship/{site}/{featuresTime}.geojson',
allowedParameters: ['verified'],
},
},
airports: {
url: 'https://8ib71h0627.execute-api.us-east-1.amazonaws.com/v1/planet/{z}/{x}/{y}?date={time}&site={site}',
name: 'Throughput at principal hub airports',
protocol: 'xyz',
tileSize: 256,
dateFormatFunction: (date) => DateTime.fromISO(date).toFormat('yyyy_MM_dd'),
Expand All @@ -348,12 +341,6 @@ export const layerNameMapping = Object.freeze({
};
return mapping[eoID];
},
features: {
name: 'Plane detections',
dateFormatFunction: (date) => DateTime.fromISO(date).toFormat('yyyy_MM_dd'),
url: 'https://8ib71h0627.execute-api.us-east-1.amazonaws.com/v1/detections/plane/{site}/{featuresTime}.geojson',
allowedParameters: ['Country', 'label', 'score'],
},
},
water_quality_chl: {
url: 'https://8ib71h0627.execute-api.us-east-1.amazonaws.com/v1/{z}/{x}/{y}@1x?url=s3://covid-eo-data/{site}-{time}.tif&resampling_method=bilinear&bidx=1&rescale=-100%2C100&color_map=rdbu_r',
Expand Down Expand Up @@ -1313,7 +1300,7 @@ export const globalIndicators = [
{
properties: {
indicatorObject: {
indicator: 'sen4ama',
indicator: 'MCD',
display: {
baseLayers: cloudlessBaseLayerDefault,
baseUrl: `https://services.sentinel-hub.com/ogc/wms/${shConfig.shInstanceId}`,
Expand Down

0 comments on commit b1b0369

Please sign in to comment.