diff --git a/backend/alembic/versions/20200810025228_add_licensed_works_layer.py b/backend/alembic/versions/20200810025228_add_licensed_works_layer.py new file mode 100644 index 000000000..25886e930 --- /dev/null +++ b/backend/alembic/versions/20200810025228_add_licensed_works_layer.py @@ -0,0 +1,96 @@ +"""add licensed works layer + +Revision ID: 369150228f9d +Revises: 603d93ba52ea +Create Date: 2020-08-10 02:52:28.638544 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '369150228f9d' +down_revision = '603d93ba52ea' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute('SET search_path TO metadata') + + # populate water_licensed_works info + op.execute(""" + WITH ds_id AS ( + INSERT INTO data_source ( + data_source_id, + data_format_code, + name, + description, + source_url, + source_object_name, + data_table_name, + source_object_id, + create_user, create_date, update_user, update_date, effective_date, expiry_date + ) VALUES ( + NEXTVAL(pg_get_serial_sequence('data_source','data_source_id')), + 'json', + 'Water Licensed Works - Lines', + 'Province-wide SDE layer showing linear works associated with a Water Licence', + 'https://catalogue.data.gov.bc.ca/dataset/water-licensed-works-lines', + 'WHSE_WATER_MANAGEMENT.WLS_WATER_LICENCED_WRK_LINE_SP', + 'water_licensed_works', + 'WATER_LICENCED_WORK_LINE_ID', + 'ETL_USER', CURRENT_DATE, 'ETL_USER', CURRENT_DATE, CURRENT_DATE, '9999-12-31T23:59:59Z' + ) RETURNING data_source_id + ), + wms_id AS ( + INSERT INTO wms_catalogue ( + wms_catalogue_id, + description, + wms_name, + wms_style, + create_user, create_date, update_user, update_date, effective_date, expiry_date + ) VALUES ( + (select wms_catalogue_id from wms_catalogue order by wms_catalogue_id desc limit 1) + 1, + 'Water Licensed Works - Lines', + 'WHSE_WATER_MANAGEMENT.WLS_WATER_LICENCED_WRK_LINE_SP', + '', + 'ETL_USER', CURRENT_DATE, 'ETL_USER', CURRENT_DATE, CURRENT_DATE, '9999-12-31T23:59:59Z' + ) RETURNING wms_catalogue_id + ) + INSERT INTO display_catalogue ( + display_data_name, + display_name, + label_column, + label, + highlight_columns, + data_source_id, + wms_catalogue_id, + layer_category_code, + mapbox_layer_id, + mapbox_source_id, + create_user, create_date, update_user, update_date, effective_date, expiry_date + ) SELECT + 'water_licensed_works', + 'Water Licensed Works - Lines', + 'WATER_LICENCED_WORK_LINE_ID', + 'Work Line ID', + ARRAY[ + 'WORKS_ID', 'FEATURE_CODE', 'DISPLAY_COLOUR' + ], + ds_id.data_source_id, + wms_id.wms_catalogue_id, + 'WATER_ADMINISTRATION', + 'iit-water.448thhpa', + 'iit-water.448thhpa', + 'ETL_USER', CURRENT_DATE, 'ETL_USER', CURRENT_DATE, CURRENT_DATE, '9999-12-31T23:59:59Z' + FROM ds_id, wms_id ; + """) + + op.execute('SET search_path TO public') + + + +def downgrade(): + pass diff --git a/frontend/src/assets/images/lines/conduit.png b/frontend/src/assets/images/lines/conduit.png new file mode 100644 index 000000000..b3b36b2c1 Binary files /dev/null and b/frontend/src/assets/images/lines/conduit.png differ diff --git a/frontend/src/assets/images/lines/ditch.png b/frontend/src/assets/images/lines/ditch.png new file mode 100644 index 000000000..1d173b896 Binary files /dev/null and b/frontend/src/assets/images/lines/ditch.png differ diff --git a/frontend/src/assets/images/lines/flume.png b/frontend/src/assets/images/lines/flume.png new file mode 100644 index 000000000..2f84cbac0 Binary files /dev/null and b/frontend/src/assets/images/lines/flume.png differ diff --git a/frontend/src/assets/images/lines/pipeline.png b/frontend/src/assets/images/lines/pipeline.png new file mode 100644 index 000000000..64af76bba Binary files /dev/null and b/frontend/src/assets/images/lines/pipeline.png differ diff --git a/frontend/src/assets/images/lines/releasechannel.png b/frontend/src/assets/images/lines/releasechannel.png new file mode 100644 index 000000000..ce7753ae4 Binary files /dev/null and b/frontend/src/assets/images/lines/releasechannel.png differ diff --git a/frontend/src/assets/images/lines/spillway.png b/frontend/src/assets/images/lines/spillway.png new file mode 100644 index 000000000..b074eed1e Binary files /dev/null and b/frontend/src/assets/images/lines/spillway.png differ diff --git a/frontend/src/assets/images/lines/tailrace.png b/frontend/src/assets/images/lines/tailrace.png new file mode 100644 index 000000000..ef349911a Binary files /dev/null and b/frontend/src/assets/images/lines/tailrace.png differ diff --git a/frontend/src/assets/images/lines/transmission.png b/frontend/src/assets/images/lines/transmission.png new file mode 100644 index 000000000..0ed94688c Binary files /dev/null and b/frontend/src/assets/images/lines/transmission.png differ diff --git a/frontend/src/components/analysis/surface_water/ModelExplanations.vue b/frontend/src/components/analysis/surface_water/ModelExplanations.vue index 616fff1d7..43d287b52 100644 --- a/frontend/src/components/analysis/surface_water/ModelExplanations.vue +++ b/frontend/src/components/analysis/surface_water/ModelExplanations.vue @@ -23,7 +23,7 @@

Steyx represents the standard error in the estimate of the hydrological variable (Y) as a function of the regression model (X). - You can find more information on what standard error is here: + You can find more information on what standard error is here: Standard Error - Wikipedia @@ -64,7 +64,7 @@ {{item.solar_exposure_co}} {{item.average_slope_co}} {{item.intercept_co}} - + diff --git a/frontend/src/components/analysis/surface_water/watershed_demand/WatershedDemand.vue b/frontend/src/components/analysis/surface_water/watershed_demand/WatershedDemand.vue index d086d29d4..6bde2280f 100644 --- a/frontend/src/components/analysis/surface_water/watershed_demand/WatershedDemand.vue +++ b/frontend/src/components/analysis/surface_water/watershed_demand/WatershedDemand.vue @@ -143,7 +143,7 @@ export default { let licenseeName = e.features[0].properties['PRIMARY_LICENSEE_NAME'] let sourceName = e.features[0].properties['SOURCE_NAME'] let qty = e.features[0].properties['qty_m3_yr'] - if(qty) { qty = qty.toFixed(1) } // fix on null value + if (qty) { qty = qty.toFixed(1) } // fix on null value let purpose = e.features[0].properties['PURPOSE_USE'] // Ensure that if the map is zoomed out such that multiple diff --git a/frontend/src/components/map/MapLegend.js b/frontend/src/components/map/MapLegend.js index 40537626b..aaa1e65d8 100644 --- a/frontend/src/components/map/MapLegend.js +++ b/frontend/src/components/map/MapLegend.js @@ -18,6 +18,23 @@ export default { try { mapLayerType = this.map.getLayer(layerID).type + // Add legend items for dashed licensed works layers + if (layerID === 'water_licensed_works') { + for (let i = 0; i < 5; i++) { + let layerName = i === 0 ? layerID : 'water_licensed_works_dash' + i + mapLayerPaint = this.getPaint(mapLayerType, layerName) + legendItems = this.getLegendItems(mapLayerPaint, mapLayerType, layerName) + var layerLegend = { + name: i === 0 ? 'Water Licensed Works - Lines' : '', + legendItems, + 'plenty': true, + 'className': 'grouped' + } + this.legend.push(layerLegend) + } + return + } + if (mapLayerType !== 'raster') { mapLayerPaint = this.getPaint(mapLayerType, layerID) legendItems = this.getLegendItems(mapLayerPaint, mapLayerType, layerID) @@ -134,13 +151,15 @@ export default { global.config.debug && console.log('[wally]', paint.color[i].constructor) if (paint.color[i].constructor === Array) { text = this.replaceLabelCode(paint.color[i].join(', ')) + let image = this.lineImage(text) color = paint.color[i + 1] legendItems.push({ text, color, outlineColor: paint.outlineColor, icon, - iconSize + iconSize, + image }) } } @@ -148,7 +167,6 @@ export default { } // Streams with allocation restrictions - for (let i = 1; i < paint.color.length; i += 2) { if (paint.color[i].constructor === Array) { text = this.replaceLabelCode(paint.color[i][2].join(', ')) @@ -187,10 +205,81 @@ export default { return 'Active Approvals' case 'Refuse/Abandoned, Cancelled': return 'Non-Active Approvals' + // Water Licensed Works + case 'DB25150000': + return 'Accessway' + case 'DB00100000': + return 'Access Road' + case 'EA06100200': + return 'Conduit - Water' + case 'GA08450000': + return 'Dam' + case 'GE09400000': + return 'Dike/Levee/Berm' + case 'GA08800000': + return 'Ditch' + case 'GB09150000': + return 'Dugout' + case 'GA11500000': + return 'Flume' + case 'GA21050000': + return 'Penstock' + case 'EA21400610': + return 'Pipeline - Water' + case 'GB22100000': + return 'Pond' + case 'GA05200200': + return 'Channel-Rearing' + case 'GB22100210': + return 'Pond-Rearing' + case 'GA05200210': + return 'Channel-Release' + case 'GB24300000': + return 'Reservoir' + case 'GB24300120': + return 'Reservoir - Balancing' + case 'DA25050180': + return 'Road (Paved Divided)' + case 'DA25100190': + return 'Road (Paved Undivided)' + case 'PI11500000': + return 'Spawning Channel' + case 'GA28550000': + return 'Spillway' + case 'EA16400110': + return 'Line (Transmission) - Electrical' + case 'GA30350000': + return 'Tailrace' + case 'DB25150000, DB00100000, DA25100190, DA25050180, GB24300120': + return 'Accessway, Access Road, Road (Paved Undivided), Road (Paved Divided), Reservoir - Balancing' + case 'GA21050000, GB22100000, GA05200200, GB22100210': + return 'Penstock, Pond, Channel-Rearing, Pond-Rearing' default: return code } }, + lineImage (name) { + switch (name) { + case 'Conduit - Water': + return 'conduit.png' + case 'Ditch': + return 'ditch.png' + case 'Flume': + return 'flume.png' + case 'Pipeline - Water': + return 'pipeline.png' + case 'Channel-Release': + return 'releasechannel.png' + case 'Spillway': + return 'spillway.png' + case 'Tailrace': + return 'tailrace.png' + case 'Line (Transmission) - Electrical': + return 'transmission.png' + default: + return null + } + }, toggle () { this.show = !this.show } diff --git a/frontend/src/components/map/MapLegend.vue b/frontend/src/components/map/MapLegend.vue index 5c2a4b7f3..d81ce187b 100644 --- a/frontend/src/components/map/MapLegend.vue +++ b/frontend/src/components/map/MapLegend.vue @@ -5,7 +5,8 @@

{{layer.name}}

- {{item.icon}} + {{item.icon}} + {{item.text}} {{layer.name}}
diff --git a/frontend/src/store/mapStore.js b/frontend/src/store/mapStore.js index a4107863b..dfb348fbb 100644 --- a/frontend/src/store/mapStore.js +++ b/frontend/src/store/mapStore.js @@ -247,7 +247,14 @@ export default { // get list of layers that were deselected (they were in `prev`, but are not in payload), // and sent an event to remove them. - prev.filter((l) => !selectedLayers.includes(l)).forEach((l) => dispatch('removeMapLayer', l)) + prev.filter((l) => !selectedLayers.includes(l)).forEach((l) => { + dispatch('removeMapLayer', l) + if (l === 'water_licensed_works') { + for (let i = 1; i < 5; i++) { + commit('deactivateLayer', 'water_licensed_works_dash' + i) + } + } + }) // similarly, now get a list of layers that are in payload but weren't in the previous active layers. selectedLayers.filter((l) => !prev.includes(l)).forEach((l) => { @@ -255,6 +262,11 @@ export default { const layerName = state.mapLayers.find(e => e.display_data_name === l).display_name window._paq && window._paq.push(['trackEvent', 'Layer', 'Activate Layer', layerName]) commit('activateLayer', l) + if (l === 'water_licensed_works') { + for (let i = 1; i < 5; i++) { + commit('activateLayer', 'water_licensed_works_dash' + i) + } + } }) // reset the list of active layers