Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

wip

Benjamin Kingab44fed98da7
diff --git a/tasks/validateOptions.py b/tasks/validateOptions.py
index 7f5811edc..3dc433203 100755
--- a/tasks/validateOptions.py
+++ b/tasks/validateOptions.py
@@ -159,12 +159,12 @@ for startingLayer in wv["defaults"]["startingLayers"]:
wv["defaults"]["startingLayers"] = startingLayers
wv["buildDate"] = int(round(time.time() * 1000))
-# for projection, projectionValue in wv["naturalEvents"]["layers"].iteritems():
-# for eventType, eventTypeLayerList in projectionValue.iteritems():
-# for layerObject in eventTypeLayerList:
-# if layerObject[0] not in wv["layers"]:
-# error("The %s layer in the Natural events %s %s config does not have a matching ID in the layer config" %
-# (layerObject[0], projection, eventType))
+for projection, projectionValue in wv["naturalEvents"]["layers"].iteritems():
+ for eventType, eventTypeLayerList in projectionValue.iteritems():
+ for layerObject in eventTypeLayerList:
+ if layerObject[0] not in wv["layers"]:
+ error("The %s layer in the Natural events %s %s config does not have a matching ID in the layer config" %
+ (layerObject[0], projection, eventType))
for measurement in wv["measurements"].values():
if "sources" not in measurement:
diff --git a/web/js/combine-models.js b/web/js/combine-models.js
index 36800a2cc..b1e88db2d 100644
--- a/web/js/combine-models.js
+++ b/web/js/combine-models.js
@@ -1,14 +1,5 @@
import util from './util/util';
-import { dateModel } from './date/model';
-import { layersModel } from './layers/model';
-
import { mapModel } from './map/model';
-import { animationModel } from './animation/model';
-import { palettesModel } from './palettes/model';
-import { dataModel } from './map/data/model';
-import { projectionModel } from './projection/model';
-import { compareModel } from './compare/model';
-import { tourModel } from './tour/model';
/**
* Return initiated legacy models Object
@@ -20,34 +11,7 @@ export function combineModels(config) {
events: util.events()
}
};
- var initialDate;
- if (config.defaults.startDate) {
- initialDate = util.parseDateUTC(config.defaults.startDate);
- } else {
- initialDate = util.now();
- if (initialDate.getUTCHours() < 3) {
- initialDate.setUTCDate(initialDate.getUTCDate() - 1);
- }
- }
- models.proj = projectionModel(config);
- models.palettes = palettesModel(models, config);
- models.layers = layersModel(models, config);
- models.date = dateModel(models, config, {
- initial: initialDate
- });
models.map = mapModel(models, config);
- if (config.features.compare) {
- models.compare = compareModel(models, config);
- }
- if (config.features.tour) {
- models.tour = tourModel(config);
- }
- if (config.features.animation) {
- // models.anim = animationModel(models, config);
- }
- if (config.features.dataDownload) {
- models.data = dataModel(models, config);
- }
return models;
}
diff --git a/web/js/combine-ui.js b/web/js/combine-ui.js
index e6fb2f43d..cd4b4d1c4 100644
--- a/web/js/combine-ui.js
+++ b/web/js/combine-ui.js
@@ -65,7 +65,7 @@ export function combineUi(models, config, MapMouseEvents, store) {
if (config.startDate) {
if (!util.browser.small) {
// If mobile device, do not build timeline
- timelineInit();
+ // timelineInit();
}
ui.dateWheels = dateWheels(models, config);
}
diff --git a/web/js/components/sidebar/layers/layer-list.js b/web/js/components/sidebar/layers/layer-list.js
index cd06fb890..d0dfc45e9 100644
--- a/web/js/components/sidebar/layers/layer-list.js
+++ b/web/js/components/sidebar/layers/layer-list.js
@@ -166,11 +166,12 @@ function mapStateToProps(state, ownProps) {
checkerBoardPattern,
layerSplit
} = ownProps;
- const { proj } = state;
+ const { proj, compare } = state;
const { runningLayers } = state.layers;
const { id } = proj;
const zoom = state.models.map.getZoom();
const zots = getZotsForActiveLayers(layers, zoom) || {};
+ const activeDateString = compare.isCompareA ? 'selected' : 'selectedB';
const activeLayers = state.layers[layerGroupName];
return {
@@ -188,7 +189,7 @@ function mapStateToProps(state, ownProps) {
return getTitles(state.config, layerId, proj, state);
},
available: id => {
- const date = state.legacy.date['active'];
+ const date = state.date[activeDateString];
return available(id, date, layers, state.config, state);
}
};
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index 127e0af9d..03b4f8754 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -192,18 +192,18 @@ class AnimationWidget extends React.Component {
}
}
function mapStateToProps(state) {
- const { legacy, layers, compare, animation, date } = state;
+ const { layers, compare, animation, date } = state;
const { startDate, endDate, speed, loop, isPlaying } = animation;
const { minDate, maxDate } = date;
const activeStr = compare.activeString;
const hasSubdailyLayers = hasSubDailySelector(layers[activeStr]);
- const zoomObj = getZoomObject(legacy.date, hasSubdailyLayers);
+ const zoomObj = getZoomObject(date, hasSubdailyLayers);
return {
startDate,
endDate,
- minDate,
- maxDate,
+ // minDate,
+ // maxDate,
hasSubdailyLayers,
incrementArray: zoomObj.array,
increment: zoomObj.increment,
diff --git a/web/js/containers/sidebar/compare.js b/web/js/containers/sidebar/compare.js
index c2bb1d656..46b7100b7 100644
--- a/web/js/containers/sidebar/compare.js
+++ b/web/js/containers/sidebar/compare.js
@@ -84,13 +84,13 @@ const mapDispatchToProps = dispatch => ({
}
});
function mapStateToProps(state, ownProps) {
- const { layers, compare, legacy } = state;
+ const { layers, compare, date } = state;
return {
isCompareA: compare.isCompareA,
layersA: getLayers(layers.active, { group: 'all', proj: 'all' }, state),
layersB: getLayers(layers.activeB, { group: 'all', proj: 'all' }, state),
- dateStringA: util.toISOStringDate(legacy.date.selected),
- dateStringB: util.toISOStringDate(legacy.date.selectedB),
+ dateStringA: util.toISOStringDate(date.selected),
+ dateStringB: util.toISOStringDate(date.selectedB),
isActive: compare.active,
height: ownProps.height
};
diff --git a/web/js/containers/test.js b/web/js/containers/test.js
index 8a0018b7c..de5bdfc8f 100644
--- a/web/js/containers/test.js
+++ b/web/js/containers/test.js
@@ -4,7 +4,6 @@ import { connect } from 'react-redux';
class Test extends Component {
render() {
- console.log(this.props);
return (
<div>
<div>TEST 123</div>
@@ -13,10 +12,7 @@ class Test extends Component {
}
}
function mapStateToProps(state) {
- console.log(state);
-
- return {
- };
+ return {};
}
export default connect(
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 487561749..348ed0109 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -385,7 +385,6 @@ function mapStateToProps(state) {
}
const dimensionsAndOffsetValues = getOffsetValues(screenWidth, hasSubDaily);
const timelineEndDateLimit = endTime.toISOString();
- console.log(date);
return {
hasSubdailyLayers,
customSelected,
diff --git a/web/js/location.js b/web/js/location.js
index 98800d22a..7537b2788 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -192,16 +192,16 @@ export function getParamObject(
legacyState,
errors
);
- const dateParamObject = getDateParameterSetup(
- parameters,
- config,
- models,
- legacyState,
- errors
- );
+ // const dateParamObject = getDateParameterSetup(
+ // parameters,
+ // config,
+ // models,
+ // legacyState,
+ // errors
+ // );
const obj = lodashAssign(
{},
- dateParamObject,
+ // dateParamObject,
// animationParamObject,
mapParamObject,
getParameters(config, parameters)
diff --git a/web/js/main.js b/web/js/main.js
index 77ea6e832..9cc95daf5 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -33,7 +33,7 @@ export let history = createBrowserHistory();
const isDebugMode = typeof DEBUG !== 'undefined';
const configURI = Brand.url('config/wv.json');
const startTime = new Date().getTime();
-// Code for when version of redux dev-tools version stops crashing
+// Code for when version of redux dev-tools plugin stops crashing
// const compose = isDebugMode
// ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ latency: 0 }) ||
// defaultCompose
@@ -60,7 +60,7 @@ window.onload = () => {
let requirements = [palettes.requirements(legacyState, config, true)];
$.when
.apply(null, requirements)
- .then(() => util.wrap(render(config, parameters, legacyState))); // Wrap render up
+ .then(() => render(config, parameters, legacyState));
})
.fail(util.error);
};
diff --git a/web/js/map/model.js b/web/js/map/model.js
index 6ff4dec3e..0c2c343a5 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -66,7 +66,9 @@ export function mapModel(models, config) {
*/
self.load = function(state, errors) {
if (state.v) {
- var proj = models.proj.selected;
+ const projId = state.p ? state.p : 'geographic';
+ var proj = config.projections[projId];
+ console.log(proj);
var extent = state.v;
var maxExtent = proj.maxExtent;
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 73184bc31..f619ecf15 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -33,6 +33,7 @@ import { mapCompare } from './compare/compare';
import { CALCULATE_RESPONSIVE_STATE } from 'redux-responsive';
import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
import { CHANGE_PROJECTION } from '../modules/projection/constants';
+import {SELECT_DATE} from '../modules/date/constants';
import * as layerConstants from '../modules/layers/constants';
import * as compareConstants from '../modules/compare/constants';
import * as paletteConstants from '../modules/palettes/constants';
@@ -123,6 +124,8 @@ export function mapui(models, config, store) {
return updateLookup();
case CALCULATE_RESPONSIVE_STATE:
return onResize();
+ case SELECT_DATE:
+ updateDate();
}
};
/*
@@ -142,7 +145,6 @@ export function mapui(models, config, store) {
});
store.subscribe(subscribeToStore);
- models.date.events.on('select', updateDate);
updateProjection(true);
};
const flyToNewExtent = function(extent, rotation) {
@@ -555,7 +557,8 @@ export function mapui(models, config, store) {
const state = store.getState();
const { compare } = state;
const layerState = state.layers;
- const activeLayerStr = compare.isCompareA ? 'active' : 'activeB';
+ const activeLayerStr = compare.activeString;
+ const activeDate = compare.isCompareA ? 'selected' : 'selectedB';
var activeLayers = getLayers(
layerState[activeLayerStr],
{},
@@ -586,7 +589,7 @@ export function mapui(models, config, store) {
index,
createLayer(def, {
group: activeLayerStr,
- date: models.date[models.date.activeDate]
+ date: state.date[activeDate]
})
);
compareMapUi.update(activeLayerStr);
diff --git a/web/js/redux-location-state-customs.js b/web/js/redux-location-state-customs.js
index 92098f0bf..fe492dfed 100644
--- a/web/js/redux-location-state-customs.js
+++ b/web/js/redux-location-state-customs.js
@@ -19,7 +19,6 @@ export function encode(value) {
return encoded;
}
export function createParamsString(qp) {
- console.log(qp)
const paramArray = Object.keys(qp).reduce((prev, key) => {
const keyString = key.toString();
const valueString = qp[key].toString();
@@ -36,7 +35,6 @@ export function createParamsString(qp) {
}
export function stateToParams(initialState, currentState, location) {
- console.log(initialState, currentState, location)
const pathConfig = createObjectFromConfig(initialState, location);
if (!pathConfig) {
return { location: { ...location } };