From 77982cc669568de3c8c0658f5440de0e76619e62 Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Tue, 19 Jul 2016 10:10:14 -0400 Subject: [PATCH 01/15] Add DEP layers to loading script Running `./setupdb.sh -p` will load the new DEP layers. These layers include a spatial index on the geom column, srid is 4326 like other layers. --- scripts/aws/setupdb.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/aws/setupdb.sh b/scripts/aws/setupdb.sh index 7a837514a..e40e8bdc4 100755 --- a/scripts/aws/setupdb.sh +++ b/scripts/aws/setupdb.sh @@ -22,7 +22,7 @@ file_to_load= load_stream=false load_mapshed=false -while getopts ":hbsdmf:" opt; do +while getopts ":hbsdpmf:" opt; do case $opt in h) echo -e $usage @@ -33,6 +33,8 @@ while getopts ":hbsdmf:" opt; do load_stream=true ;; d) load_drb_streams=true ;; + p) + load_dep=true ;; m) load_mapshed=true ;; f) @@ -74,6 +76,16 @@ if [ ! -z "$file_to_load" ] ; then download_and_load $FILES fi +if [ "$load_dep" = "true" ] ; then + # Fetch DEP layers + FILES=("dep_urban_areas.sql.gz" "dep_municipalities.sql.gz") + PATHS=("dep_urbanareas" "dep_municipalities") + + download_and_load $FILES + purge_tile_cache $PATHS +fi + + if [ "$load_boundary" = "true" ] ; then # Fetch boundary layer sql files FILES=("boundary_county.sql.gz" "boundary_school_district.sql.gz" "boundary_district.sql.gz" "boundary_huc12.sql.gz" "boundary_huc10.sql.gz" "boundary_huc08.sql.gz") From a1e9175b03d37c1751ba597c346bb01ed43a8dbd Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Tue, 19 Jul 2016 11:35:56 -0400 Subject: [PATCH 02/15] Add DEP Municipalities and Urban Areas to layers Add the two new DEP layers into the map's layer control. Municipalities is a vector layer which is displayed as a boundary option. Urban Areas, though a vector in data source, is rendered as "raster" coverage option with a gray polygon fill. --- src/mmw/mmw/settings/layer_settings.py | 20 ++++++++++++++++++++ src/tiler/server.js | 4 +++- src/tiler/styles.mss | 9 ++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/mmw/mmw/settings/layer_settings.py b/src/mmw/mmw/settings/layer_settings.py index b625f3fca..f900dbb64 100644 --- a/src/mmw/mmw/settings/layer_settings.py +++ b/src/mmw/mmw/settings/layer_settings.py @@ -22,6 +22,26 @@ drb_perimeter = json.load(drb_perimeter_file) LAYERS = [ + { + 'code': 'municipalities', + 'table_name': 'dep_municipalities', + 'display': 'DEP PA Municipalities', + 'short_display': 'DEP PA Municipalities', + 'vector': True, + 'overlay': True, + 'minZoom': 7, + }, + { + 'code': 'urban_areas', + 'table_name': 'dep_urban_areas', + 'display': 'DEP PA Urban Areas', + 'short_display': 'DEP PA Urban Areas', + 'raster': True, + 'overlay': True, + 'minZoom': 7, + 'opacity': 0.618, + 'has_opacity_slider': True + }, { 'code': 'huc8', 'display': 'USGS Subbasin unit (HUC-8)', diff --git a/src/tiler/server.js b/src/tiler/server.js index 0a9528813..d9fcf608a 100644 --- a/src/tiler/server.js +++ b/src/tiler/server.js @@ -34,7 +34,9 @@ var interactivity = { huc10: 'boundary_huc10', huc12: 'boundary_huc12', 'drb_streams': 'drb_streams_50', - stream: 'nhdflowline' + stream: 'nhdflowline', + municipalities: 'dep_municipalities', + urban_areas: 'dep_urban_areas' }, shouldCacheRequest = function(req) { // Caching can happen if the bucket to write to is defined diff --git a/src/tiler/styles.mss b/src/tiler/styles.mss index f914db6c3..9b7164318 100644 --- a/src/tiler/styles.mss +++ b/src/tiler/styles.mss @@ -7,7 +7,8 @@ #boundary_school_district, #boundary_huc08, #boundary_huc10, -#boundary_huc12 { +#boundary_huc12, +#dep_municipalities { ::case { line-color: #FFF; line-opacity: 0.5; @@ -24,6 +25,12 @@ } } +#dep_urban_areas { + ::fill { + polygon-fill: #ccc; + } +} + @zoomBase: 0.5; #drb_streams_50, From 799f98a1ae281bf32707305c1537f51af595e521 Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Tue, 19 Jul 2016 11:45:49 -0400 Subject: [PATCH 03/15] Ensure consistent ordering of layers Previously, overlay layers were added in the map in the order that they were selected from the layer control. The boundaries being near the top resulted in them often showing below the overlays, which would be selected second. This commit gives a consisten zIndex to each type of layer so that the boundaries are always drawn on top. --- src/mmw/js/src/core/views.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mmw/js/src/core/views.js b/src/mmw/js/src/core/views.js index 3a7575011..9d1f96c00 100644 --- a/src/mmw/js/src/core/views.js +++ b/src/mmw/js/src/core/views.js @@ -405,7 +405,7 @@ var MapView = Marionette.ItemView.extend({ } else if (!layer.empty) { var tileUrl = (layer.url.match(/png/) === null ? layer.url + '.png' : layer.url), - zIndex = layer.overlay ? 1 : 0; + zIndex = determineZIndex(layer); _.defaults(layer, { zIndex: zIndex, @@ -425,6 +425,21 @@ var MapView = Marionette.ItemView.extend({ layers[layer['display']] = leafletLayer; }); + function determineZIndex(layer) { + // ZIndex rules to keep coverages under the boundary lines + // basemaps: 0 + // overlay::raster: 1 + // overlay::vector: 2 + + if (!layer.overlay) { + return 0; + } else if (layer.raster) { + return 1; + } else { + return 2; + } + } + function actOnUI(datum, bool) { var code = datum.code, $el = $('#overlays-layer-list #' + code); From 2d135f6652234e695eacce07e2546535e68a5599 Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Tue, 19 Jul 2016 13:40:52 -0400 Subject: [PATCH 04/15] Restrict DEP layers to PA Viewport DEP Municipalities and Urban Areas control in the Layer Selector should not be enabled unless the viewport contains PA. The bounding geography for PA was a rough sketch of just 10 vertices that covers the state, to keep the file small and the Poly in Poly test fast. Zoom level restrictions on rendering still apply. --- src/mmw/mmw/settings/data/pa_perimeter.json | 1 + src/mmw/mmw/settings/layer_settings.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/mmw/mmw/settings/data/pa_perimeter.json diff --git a/src/mmw/mmw/settings/data/pa_perimeter.json b/src/mmw/mmw/settings/data/pa_perimeter.json new file mode 100644 index 000000000..33aa13f26 --- /dev/null +++ b/src/mmw/mmw/settings/data/pa_perimeter.json @@ -0,0 +1 @@ +{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-75.11352539062499,42.0125705565935],[-79.7607421875,42.01665183556825],[-79.78271484375,42.27730877423709],[-80.5352783203125,41.97174336327968],[-80.52978515625,39.690280594818034],[-75.43212890625,39.740986355883564],[-74.7509765625,40.16208338164619],[-75.04486083984375,40.84913799774759],[-74.68505859374999,41.42625319507272],[-75.0146484375,41.68932225997044],[-75.11352539062499,42.0125705565935]]]}} diff --git a/src/mmw/mmw/settings/layer_settings.py b/src/mmw/mmw/settings/layer_settings.py index f900dbb64..fef23dd21 100644 --- a/src/mmw/mmw/settings/layer_settings.py +++ b/src/mmw/mmw/settings/layer_settings.py @@ -21,6 +21,11 @@ drb_perimeter_file = open(drb_perimeter_path) drb_perimeter = json.load(drb_perimeter_file) +# Simplified perimeter of PA, used for DEP specific layers +pa_perimeter_path = join(dirname(abspath(__file__)), 'data/pa_perimeter.json') +pa_perimeter_file = open(pa_perimeter_path) +pa_perimeter = json.load(pa_perimeter_file) + LAYERS = [ { 'code': 'municipalities', @@ -30,6 +35,7 @@ 'vector': True, 'overlay': True, 'minZoom': 7, + 'perimeter': pa_perimeter, }, { 'code': 'urban_areas', @@ -40,7 +46,8 @@ 'overlay': True, 'minZoom': 7, 'opacity': 0.618, - 'has_opacity_slider': True + 'has_opacity_slider': True, + 'perimeter': pa_perimeter, }, { 'code': 'huc8', From 5655f7263388414b96ce59b6c0933a6a593aaabb Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Tue, 19 Jul 2016 15:40:41 -0400 Subject: [PATCH 05/15] Diminish text for disabled raster layers Previously, only vector layers styled the disabled state on their layer names. Now rasters use the same style. --- src/mmw/sass/base/_map.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/sass/base/_map.scss b/src/mmw/sass/base/_map.scss index 7a78ec8cc..383dfcc99 100644 --- a/src/mmw/sass/base/_map.scss +++ b/src/mmw/sass/base/_map.scss @@ -77,7 +77,7 @@ height: 100%; } -#overlay-subclass-vector .disabled { +#overlay-subclass-vector, #overlay-subclass-raster .disabled { color: $black-54; } From e2677c79fbeaff60c6d7e88458bd8c2e26b00902 Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Wed, 20 Jul 2016 11:33:25 -0400 Subject: [PATCH 06/15] Fix layer selector text from being always disabled Fixes a bug introduced in 5655f726 that resulted in all Boundary layer text in being disabled "looking" even when they were in fact enabled. --- src/mmw/sass/base/_map.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/sass/base/_map.scss b/src/mmw/sass/base/_map.scss index 383dfcc99..410827122 100644 --- a/src/mmw/sass/base/_map.scss +++ b/src/mmw/sass/base/_map.scss @@ -77,7 +77,7 @@ height: 100%; } -#overlay-subclass-vector, #overlay-subclass-raster .disabled { +#overlay-subclass-vector .disabled, #overlay-subclass-raster .disabled { color: $black-54; } From 9c0f2b2f8dd4c25c23b74386b969bc0429cce371 Mon Sep 17 00:00:00 2001 From: Matthew McFarland Date: Wed, 20 Jul 2016 16:25:00 -0400 Subject: [PATCH 07/15] Add border to Urban Areas tile renderer Update style to include a light border around features. --- src/tiler/styles.mss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tiler/styles.mss b/src/tiler/styles.mss index 9b7164318..80df458a2 100644 --- a/src/tiler/styles.mss +++ b/src/tiler/styles.mss @@ -26,6 +26,10 @@ } #dep_urban_areas { + ::case { + line-color: #7F7F7F; + line-width: 1; + } ::fill { polygon-fill: #ccc; } From 951b544706f319cb1a13478d31fa44025ec5848f Mon Sep 17 00:00:00 2001 From: Casey Thomas Date: Mon, 25 Jul 2016 12:38:30 -0400 Subject: [PATCH 08/15] Make .leaflet-top CSS override rule more specific Only apply the modified .leaflet-top rule to elements in .leaflet-control-container. The rule was originally added to target these elements. Since it was applied more broadly, it caused issues with the Google Leaflet plugin, which adds the leaflet-top class to the container used to house the Google tiles. Refs #1237 Refs #1238 --- src/mmw/sass/base/_map.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mmw/sass/base/_map.scss b/src/mmw/sass/base/_map.scss index 410827122..4c2fe5eab 100644 --- a/src/mmw/sass/base/_map.scss +++ b/src/mmw/sass/base/_map.scss @@ -102,7 +102,7 @@ float: right; } -.leaflet-top { +.leaflet-control-container .leaflet-top { top: 45px; } From ad889d94e0cd8077a66655fa7ad01e9fe4d6cd3b Mon Sep 17 00:00:00 2001 From: Kelly Innes Date: Mon, 25 Jul 2016 13:12:51 -0400 Subject: [PATCH 09/15] Rename and reorder PA DEP layers - move PA DEP layers to the end of the `layer_settings` list - rename "PA DEP Municipalities" -> "PA Municipalities" & "DEP PA Urban Areas" -> "PA Urbanized Areas" --- src/mmw/mmw/settings/layer_settings.py | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/mmw/mmw/settings/layer_settings.py b/src/mmw/mmw/settings/layer_settings.py index fef23dd21..00368cfc6 100644 --- a/src/mmw/mmw/settings/layer_settings.py +++ b/src/mmw/mmw/settings/layer_settings.py @@ -27,28 +27,6 @@ pa_perimeter = json.load(pa_perimeter_file) LAYERS = [ - { - 'code': 'municipalities', - 'table_name': 'dep_municipalities', - 'display': 'DEP PA Municipalities', - 'short_display': 'DEP PA Municipalities', - 'vector': True, - 'overlay': True, - 'minZoom': 7, - 'perimeter': pa_perimeter, - }, - { - 'code': 'urban_areas', - 'table_name': 'dep_urban_areas', - 'display': 'DEP PA Urban Areas', - 'short_display': 'DEP PA Urban Areas', - 'raster': True, - 'overlay': True, - 'minZoom': 7, - 'opacity': 0.618, - 'has_opacity_slider': True, - 'perimeter': pa_perimeter, - }, { 'code': 'huc8', 'display': 'USGS Subbasin unit (HUC-8)', @@ -232,6 +210,28 @@ 'googleType': 'TERRAIN', # SATELLITE, ROADMAP, HYBRID, or TERRAIN 'maxZoom': 20, 'basemap': True, + }, + { + 'code': 'municipalities', + 'table_name': 'dep_municipalities', + 'display': 'PA Municipalities', + 'short_display': 'PA Municipalities', + 'vector': True, + 'overlay': True, + 'minZoom': 7, + 'perimeter': pa_perimeter, + }, + { + 'code': 'urban_areas', + 'table_name': 'dep_urban_areas', + 'display': 'PA Urbanized Areas', + 'short_display': 'PA Urbanized Areas', + 'raster': True, + 'overlay': True, + 'minZoom': 7, + 'opacity': 0.618, + 'has_opacity_slider': True, + 'perimeter': pa_perimeter, } ] From 30f18e440e0e0565a94cebe013012d856909a7c6 Mon Sep 17 00:00:00 2001 From: Lewis Fishgold Date: Mon, 25 Jul 2016 14:10:16 -0400 Subject: [PATCH 10/15] Set Modeling view title Set the page title according to the model package. --- src/mmw/js/src/modeling/controllers.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mmw/js/src/modeling/controllers.js b/src/mmw/js/src/modeling/controllers.js index 9ec16648e..8d2a1d8e8 100644 --- a/src/mmw/js/src/modeling/controllers.js +++ b/src/mmw/js/src/modeling/controllers.js @@ -59,6 +59,8 @@ var ModelingController = { // Send URL to parent if in embed mode updateItsiFromEmbedMode(); + + setPageTitle(); }); }) .fail(function() { @@ -67,6 +69,8 @@ var ModelingController = { console.log("[ERROR] Could not load project."); App.currentProject = null; }); + + App.state.set('current_page_title', 'Modeling'); } else { if (App.currentProject && settings.get('activityMode')) { project = App.currentProject; @@ -85,6 +89,7 @@ var ModelingController = { var lock = $.Deferred(); if (!App.currentProject) { + project = reinstateProject(App.projectNumber, lock); App.currentProject = project; @@ -99,9 +104,8 @@ var ModelingController = { finishProjectSetup(project, lock); } + setPageTitle(); } - - App.state.set('current_page_title', 'Model'); }, makeNewProject: function(modelPackage) { @@ -120,6 +124,7 @@ var ModelingController = { updateUrl(); } App.rootView.showCollapsable(); + setPageTitle(); }, projectCleanUp: function() { @@ -162,6 +167,8 @@ var ModelingController = { if (project.get('is_activity')) { settings.set('activityMode', true); } + + setPageTitle(); }) .fail(function() { App.currentProject = null; @@ -227,6 +234,14 @@ function finishProjectSetup(project, lock) { }); } +function setPageTitle() { + var modelPackageName = App.currentProject.get('model_package'), + modelPackages = settings.get('model_packages'), + modelPackageDisplayName = _.find(modelPackages, {name: modelPackageName}).display_name; + + App.state.set('current_page_title', modelPackageDisplayName); +} + function projectCleanUp() { App.rootView.hideCollapsable(); if (App.currentProject) { @@ -323,6 +338,7 @@ function reinstateProject(number, lock) { 'areaOfInterest': project.get('area_of_interest'), 'areaOfInterestName': project.get('area_of_interest_name') }); + setPageTitle(); lock.resolve(); }); From 8c5fa5ad935d7c5a6a603f44abc7d479320c2726 Mon Sep 17 00:00:00 2001 From: Casey Thomas Date: Mon, 25 Jul 2016 17:24:08 -0400 Subject: [PATCH 11/15] Micro: Make data attribute more generic Use the more generic term of "category" for the data attribute that defines what land cover the tile represents. We'll soon use these attributes for the soil tiles. Refs #1123 --- .../templates/home_page/index.html | 24 +++++++++---------- src/mmw/js/src/main_water_balance.js | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mmw/apps/water_balance/templates/home_page/index.html b/src/mmw/apps/water_balance/templates/home_page/index.html index c6f2f6eeb..861f0f3b7 100644 --- a/src/mmw/apps/water_balance/templates/home_page/index.html +++ b/src/mmw/apps/water_balance/templates/home_page/index.html @@ -210,84 +210,84 @@

0.0 cm

  • - Open Water + Open Water
  • - Developed, Open Space + Developed, Open Space
  • - Developed, Low Intensity + Developed, Low Intensity
  • - Developed, Medium Intensity + Developed, Medium Intensity
  • - Developed High Intensity + Developed High Intensity
  • - Barren Land (Rock/Sand/Clay) + Barren Land (Rock/Sand/Clay)
  • - Forest + Forest
  • - Shrub/Scrub + Shrub/Scrub
  • - Grassland/Herbaceous + Grassland/Herbaceous
  • - Pasture/Hay + Pasture/Hay
  • - Cultivated Crops + Cultivated Crops
  • - Wetlands + Wetlands
  • diff --git a/src/mmw/js/src/main_water_balance.js b/src/mmw/js/src/main_water_balance.js index 77caca923..cc5c94bd7 100644 --- a/src/mmw/js/src/main_water_balance.js +++ b/src/mmw/js/src/main_water_balance.js @@ -130,10 +130,10 @@ var initBootstrap = function() { $('[data-toggle="popover"]').each(function(i, popover) { var $popover = $(popover), - nlcd = $popover.data('nlcd') || 'default', + category = $popover.data('category') || 'default', template = '', entry = modificationConfig[$popover.data('name')], options = { From 5105b6b08822a9aaaf39b90756f7a4b954f881b6 Mon Sep 17 00:00:00 2001 From: Casey Thomas Date: Mon, 25 Jul 2016 17:24:27 -0400 Subject: [PATCH 12/15] Micro: Add soil CSS classes and data attributes Add classes for tiles and popover that correspond to the different soil types. This allows the active selection element and popover header to be colored with the corresponding soil type color. Refs #1123 --- .../templates/home_page/index.html | 16 +++--- src/mmw/sass/pages/_water-balance.scss | 50 +++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/mmw/apps/water_balance/templates/home_page/index.html b/src/mmw/apps/water_balance/templates/home_page/index.html index 861f0f3b7..381eea8f7 100644 --- a/src/mmw/apps/water_balance/templates/home_page/index.html +++ b/src/mmw/apps/water_balance/templates/home_page/index.html @@ -302,29 +302,29 @@

    0.0 cm