Skip to content

Commit

Permalink
fix: solved issue of poi map times not selecting default; solved zoom…
Browse files Browse the repository at this point in the history
…ing to poi on selection; removed debugging
  • Loading branch information
santilland committed Jul 24, 2023
1 parent 2651c58 commit 6b50163
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
26 changes: 20 additions & 6 deletions app/src/components/map/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ export default {
...this.featureObject,
...this.featureData,
};
// Convert feature data time to strings
const time = this.featureData.time.map((t) => t.toISO({ suppressMilliseconds: true }));
mergedIndicator.time = time;
// Add name from top level indicator to feature indicator
mergedIndicator.name = this.indicator.name;
return createConfigFromIndicator(
Expand Down Expand Up @@ -405,6 +408,9 @@ export default {
...this.featureObject,
...this.featureData,
};
// Convert feature data time to strings
const time = this.featureData.time.map((t) => t.toISO({ suppressMilliseconds: true }));
mergedIndicator.time = time;
// Add name from top level indicator to feature indicator
mergedIndicator.name = this.indicator.name;
return createConfigFromIndicator(
Expand Down Expand Up @@ -481,6 +487,18 @@ export default {
},
// extent to be zoomed to. Padding will be applied.
zoomExtent() {
const { map } = getMapInstance(this.mapId);
// Check for possible selected poi
if (this.featureObject && 'aoi' in this.featureObject) {
const { aoi } = this.featureObject;
const buf = 0.05;
const extent = [aoi.lon - buf, aoi.lat - buf, aoi.lon + buf, aoi.lat + buf];
return transformExtent(
extent, 'EPSG:4326', map.getView().getProjection(),
);
}
// Handle extent configuration for overall indicator
if ((this.centerProp && this.zoomProp)
|| (!this.indicator?.subAoi?.features && !this.mergedConfigsData[0]?.presetView)) {
return null;
Expand All @@ -494,7 +512,6 @@ export default {
}
}
const presetView = this.mergedConfigsData[0]?.presetView;
const { map } = getMapInstance(this.mapId);
const readerOptions = {
dataProjection: 'EPSG:4326',
featureProjection: map.getView().getProjection(),
Expand All @@ -506,8 +523,6 @@ export default {
);
return presetViewGeom.getExtent();
}
debugger;
// TODO: Consider how to fetch subaoi
const { subAoi } = this.indicator;
if (subAoi && subAoi.features.length) {
if (subAoi.features[0].geometry.coordinates.length) {
Expand All @@ -517,14 +532,14 @@ export default {
// geoJsonFormat
return [];
}
debugger;
// TOD: Make sure tthis works
/*
if (this.featureObject.aoi) {
return transformExtent([this.featureObject.lng, this.featureObject.lat,
this.featureObject.lng, this.featureObject.lat],
'EPSG:4326',
map.getView().getProjection());
}
*/
return undefined;
},
},
Expand Down Expand Up @@ -559,7 +574,6 @@ export default {
},
},
dataLayerTime(timeObj) {
debugger;
if (timeObj) {
// redraw all time-dependant layers, if time is passed via WMS params
const { map } = getMapInstance(this.mapId);
Expand Down
8 changes: 0 additions & 8 deletions app/src/helpers/mapConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,6 @@ const mergedConfigs = (usedTimes, side = 'data', inputDataConfig, indicatorObjec
};
}
}
// only add default layer if a display configuration exists
/*
let defaultLayers = {};
if (indicatorObject.display) {
defaultLayers = baseConfig.defaultLayersDisplay;
}
*/
finalConfigs.push({
...baseConfig.defaultLayersDisplay,
...indDefinition,
Expand Down Expand Up @@ -238,7 +231,6 @@ const createAvailableTimeEntries = (indicatorObject, config) => {
name: label,
});
}
debugger;
return selectionOptions;
};

Expand Down

0 comments on commit 6b50163

Please sign in to comment.