From d5820d0f03d7db60dac56ab116666df31e385478 Mon Sep 17 00:00:00 2001 From: Jake Adams Date: Thu, 26 Oct 2023 11:01:07 -0600 Subject: [PATCH] feat: working updates --- .vscode/launch.json | 16 + setup.py | 2 +- src/nfhl/config.py | 53 +- src/nfhl/fld_haz_ar_drawingInfo.json | 1064 ++++++++++++++++++++++++++ src/nfhl/main.py | 113 ++- src/nfhl/requirements.txt | 8 + 6 files changed, 1233 insertions(+), 23 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 src/nfhl/fld_haz_ar_drawingInfo.json create mode 100644 src/nfhl/requirements.txt diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2b2502c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": false + } + ] +} \ No newline at end of file diff --git a/setup.py b/setup.py index 955f1c9..312e8fe 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ keywords=['gis'], install_requires=[ # 'arcgis==2.1.*', - 'ugrc-palletjack==3.*', + 'ugrc-palletjack==4.*', 'agrc-supervisor==3.0.*', ], extras_require={ diff --git a/src/nfhl/config.py b/src/nfhl/config.py index 0cd918f..f8bbe30 100644 --- a/src/nfhl/config.py +++ b/src/nfhl/config.py @@ -5,21 +5,54 @@ import logging import socket -SKID_NAME = '' +SKID_NAME = 'nfhl_skid' -AGOL_ORG = 'https://utah.maps.arcgis.com' +AGOL_ORG = 'https://utah-em.maps.arcgis.com' SENDGRID_SETTINGS = { #: Settings for SendGridHandler 'from_address': 'noreply@utah.gov', - 'to_addresses': '', + 'to_addresses': 'jdadams@utah.gov', 'prefix': f'{SKID_NAME} on {socket.gethostname()}: ', } -LOG_LEVEL = logging.DEBUG +LOG_LEVEL = logging.INFO LOG_FILE_NAME = 'log' -FEATURE_LAYER_ITEMID = '' -JOIN_COLUMN = '' -ATTACHMENT_LINK_COLUMN = '' -ATTACHMENT_PATH_COLUMN = '' -FIELDS = { - +TIMEOUT = 20 +SERVICE_URL = 'https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer' +FEMA_LAYERS = { + # 'S_LOMR': { + # 'number': 1, + # 'itemid': '647c5dfc31044b0aba7611f0b7b3ed62', + # 'name': 'S_LOMR', + # 'date_fields': ['eff_date'] + # }, + # 'S_FIRM_Pan': { + # 'number': 3, + # 'itemid': 'cb041caea3ad4b48bef4502e10e14368', + # 'name': 'S_FIRM_Pan', + # 'date_fields': ['pre_date', 'eff_date'] + # }, + # 'S_XS': { + # 'number': 14, + # 'itemid': '4c87be2e986643e2b82b787d630c83a6', + # 'name': 'S_XS', + # 'double_fields': ['stream_stn', 'wsel_reg', 'strmbed_el'], + # 'int_fields': ['seq'] + # }, + # 'S_BFE': { + # 'number': 16, + # 'itemid': '8cab946b96d94167bd75314c32584d1a', + # 'name': 'S_BFE', + # 'double_fields': ['elev'] + # }, + # 'S_Wtr_Ln': { + # 'number': 20, + # 'itemid': 'f784f6c8b32a4f7abe180c4e37ffb8d6', + # 'name': 'S_Wtr_Ln', + # }, + 'S_Fld_Haz_Ar': { + 'number': 28, + 'itemid': 'b2c606f13a4c4a59b3c253647883833f', + 'name': 'S_Fld_Haz_Ar', + 'double_fields': ['static_bfe', 'depth', 'velocity', 'bfe_revert', 'dep_revert'], + }, } diff --git a/src/nfhl/fld_haz_ar_drawingInfo.json b/src/nfhl/fld_haz_ar_drawingInfo.json new file mode 100644 index 0000000..251009d --- /dev/null +++ b/src/nfhl/fld_haz_ar_drawingInfo.json @@ -0,0 +1,1064 @@ +{ + "renderer": { + "type": "uniqueValue", + "field1": "label", + "defaultSymbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 0.7, + "color": [ + 110, + 110, + 110, + 0 + ] + }, + { + "type": "CIMSolidFill", + "enable": true, + "color": [ + 130, + 130, + 130, + 255 + ] + } + ], + "angleAlignment": "Map" + } + }, + "defaultLabel": "", + "uniqueValueInfos": [ + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 1, + "color": [ + 255, + 255, + 255, + 100 + ] + }, + { + "type": "CIMSolidFill", + "enable": true, + "color": [ + 255, + 128, + 0, + 77 + ] + } + ], + "angleAlignment": "Map" + } + }, + "value": "0.2% Annual Chance Flood Hazard", + "label": "0.2% Annual Chance Flood Hazard" + }, + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 1, + "color": [ + 255, + 255, + 255, + 100 + ] + }, + { + "type": "CIMSolidFill", + "enable": true, + "color": [ + 0, + 230, + 255, + 77 + ] + } + ], + "angleAlignment": "Map" + } + }, + "value": "1% Annual Chance Flood Hazard", + "label": "1% Annual Chance Flood Hazard" + }, + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 0.7, + "color": [ + 110, + 110, + 110, + 0 + ] + }, + { + "type": "CIMSolidFill", + "enable": true, + "color": [ + 179, + 238, + 255, + 0 + ] + } + ], + "angleAlignment": "Map" + } + }, + "value": "", + "label": "" + }, + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 0.7, + "color": [ + 110, + 110, + 110, + 0 + ] + }, + { + "type": "CIMSolidFill", + "enable": true, + "color": [ + 242, + 230, + 115, + 77 + ] + } + ], + "angleAlignment": "Map" + } + }, + "value": "Area of Undetermined Flood Hazard", + "label": "Area of Undetermined Flood Hazard" + }, + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 1, + "color": [ + 255, + 255, + 255, + 100 + ] + }, + { + "type": "CIMHatchFill", + "enable": true, + "lineSymbol": { + "type": "CIMLineSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 4, + "width": 5, + "color": [ + 0, + 0, + 0, + 77 + ] + } + ] + }, + "offsetX": 5, + "rotation": 45, + "separation": 10, + "offsetY": 5 + }, + { + "type": "CIMHatchFill", + "enable": true, + "lineSymbol": { + "type": "CIMLineSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 4, + "width": 5, + "color": [ + 255, + 128, + 0, + 77 + ] + } + ] + }, + "rotation": 45, + "separation": 10 + } + ], + "angleAlignment": "Map" + } + }, + "value": "Area with Reduced Flood Risk due to Levee", + "label": "Area with Reduced Flood Risk due to Levee" + }, + { + "symbol": { + "type": "CIMSymbolReference", + "symbol": { + "type": "CIMPolygonSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 10, + "width": 1, + "color": [ + 255, + 255, + 255, + 100 + ] + }, + { + "type": "CIMHatchFill", + "enable": true, + "lineSymbol": { + "type": "CIMLineSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 4, + "width": 5, + "color": [ + 255, + 0, + 0, + 77 + ] + } + ] + }, + "offsetX": 5, + "rotation": 45, + "separation": 10, + "offsetY": 5 + }, + { + "type": "CIMHatchFill", + "enable": true, + "lineSymbol": { + "type": "CIMLineSymbol", + "symbolLayers": [ + { + "type": "CIMSolidStroke", + "enable": true, + "capStyle": "Round", + "joinStyle": "Round", + "lineStyle3D": "Strip", + "miterLimit": 4, + "width": 5, + "color": [ + 0, + 230, + 255, + 77 + ] + } + ] + }, + "rotation": 45, + "separation": 10 + } + ], + "angleAlignment": "Map" + } + }, + "value": "Regulatory Floodway", + "label": "Regulatory Floodway" + } + ], + "fieldDelimiter": ",", + "authoringInfo": { + "colorRamp": { + "type": "multipart", + "colorRamps": [ + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 246, + 187, + 252, + 255 + ], + "toColor": [ + 246, + 187, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 185, + 252, + 182, + 255 + ], + "toColor": [ + 185, + 252, + 182, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 252, + 217, + 194, + 255 + ], + "toColor": [ + 252, + 217, + 194, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 182, + 243, + 252, + 255 + ], + "toColor": [ + 182, + 243, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 252, + 250, + 179, + 255 + ], + "toColor": [ + 252, + 250, + 179, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 204, + 212, + 252, + 255 + ], + "toColor": [ + 204, + 212, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 252, + 179, + 200, + 255 + ], + "toColor": [ + 252, + 179, + 200, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 210, + 252, + 224, + 255 + ], + "toColor": [ + 210, + 252, + 224, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 182, + 179, + 252, + 255 + ], + "toColor": [ + 182, + 179, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 252, + 215, + 252, + 255 + ], + "toColor": [ + 252, + 215, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 252, + 246, + 210, + 255 + ], + "toColor": [ + 252, + 246, + 210, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 221, + 194, + 252, + 255 + ], + "toColor": [ + 221, + 194, + 252, + 255 + ] + }, + { + "type": "algorithmic", + "algorithm": "esriCIELabAlgorithm", + "fromColor": [ + 225, + 252, + 189, + 255 + ], + "toColor": [ + 225, + 252, + 189, + 255 + ] + } + ] + } + } + }, + "scaleSymbols": true, + "labelingInfo": [ + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.ZONE_SUBTY != '') {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.ZONE_SUBTY == '') {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT}\nelse if ($feature.DUAL_ZONE != 'T' && $feature.ZONE_SUBTY != '') {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE}\nelse {\n return \"Zone \" + $feature.FLD_ZONE}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY = 'COLORADO RIVER FLOODWAY'\nOR ZONE_SUBTY = 'ADMINISTRATIVE FLOODWAY' OR ZONE_SUBTY IS NULL OR ZONE_SUBTY NOT LIKE '%FLOODWAY%' AND ZONE_SUBTY <> '1100')\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'AREA OF MINIMAL FLOOD HAZARD' AND ZONE_SUBTY <> '0.2 PCT ANNUAL CHANCE FLOOD HAZARD'))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY NOT IN ('RIVERINE FLOODWAY SHOWN IN COASTAL ZONE','COMBINED RIVERINE AND COASTAL FLOODPLAIN','RIVERINE FLOODPLAIN IN COASTAL AREA','RIVERINE FLOODWAY IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT Annual Chance Flood Hazard in Coastal Zone','RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COASTAL ZONE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM')))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'COASTAL FLOODPLAIN'))\n\nAND (ZONE_SUBTY IS NULL OR (FLD_ZONE <> 'X'))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY LIKE '%FUTURE CONDITIONS%' AND ((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY IN ('AREA WITH REDUCED FLOOD RISK DUE TO LEVEE','AREA WITH REDUCED FLOOD HAZARD DUE TO ACCREDITED LEVEE SYSTEM','AREA WITH REDUCED FLOOD HAZARD DUE TO PROVISIONALLY ACCREDITED LEVEE SYSTEM') AND ((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY IN ('1 PERCENT DEPTH LESS THAN 1 FOOT','1 PERCENT DRAINAGE AREA LESS THAN 1 SQUARE MILE') AND ((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'D' AND ZONE_SUBTY = 'AREA WITH UNDETERMINED FLOOD HAZARD DUE TO NONACCREDITED LEVEE SYSTEM' AND ((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "Default", + "priority": 5, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "center", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 254, + 254, + 254, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'A') {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \"/\" + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AE' && $feature.BFE_REVERT != -9999) {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\" + \"(EL \" + $feature.BFE_REVERT + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AH') {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AO' && $feature.DEP_REVERT != -9999) {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\"\n}\nelse {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\"\n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "STATIC_BFE > 0 and STATIC_BFE is not NULL and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY = 'COLORADO RIVER FLOODWAY'\nOR ZONE_SUBTY = 'ADMINISTRATIVE FLOODWAY' OR ZONE_SUBTY IS NULL OR ZONE_SUBTY NOT LIKE '%FLOODWAY%' AND ZONE_SUBTY <> '1100')\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'AREA OF MINIMAL FLOOD HAZARD' AND ZONE_SUBTY <> '0.2 PCT ANNUAL CHANCE FLOOD HAZARD'))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY NOT IN ('1240','RIVERINE FLOODWAY SHOWN IN COASTAL ZONE','COMBINED RIVERINE AND COASTAL FLOODPLAIN','RIVERINE FLOODPLAIN IN COASTAL AREA','RIVERINE FLOODWAY IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT Annual Chance Flood Hazard in Coastal Zone','RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN STRUCTURE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN CHANNEL', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COASTAL ZONE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM')))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'COASTAL FLOODPLAIN'))\n\nAND (ZONE_SUBTY IS NULL OR (FLD_ZONE <> 'X'))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY IN ('AREA WITH REDUCED FLOOD RISK DUE TO LEVEE','AREA WITH REDUCED FLOOD HAZARD DUE TO ACCREDITED LEVEE SYSTEM','AREA WITH REDUCED FLOOD HAZARD DUE TO PROVISIONALLY ACCREDITED LEVEE SYSTEM') AND STATIC_BFE > 0 and STATIC_BFE is not NULL and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY LIKE '%FUTURE CONDITIONS%' AND STATIC_BFE > 0 and STATIC_BFE is not NULL and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'D' AND ZONE_SUBTY = 'AREA WITH UNDETERMINED FLOOD HAZARD DUE TO NONACCREDITED LEVEE SYSTEM' AND STATIC_BFE > 0 and STATIC_BFE is not NULL and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "Static BFE", + "priority": 7, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "center", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 254, + 254, + 254, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\" && $feature.DEP_REVERT != \"\" && $feature.DEP_REVERT != -9999) {\n return \"\" + $feature.ZONE_SUBTY + \"\" + \"\" + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + \"\" + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\") {\n return \"\" + $feature.ZONE_SUBTY + \"\" + \"\" + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + \"\" + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\"\n}\nelse {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\"\n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "( (not STATIC_BFE > 0) or STATIC_BFE is null ) and DEPTH > 0 and ( (not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY = 'COLORADO RIVER FLOODWAY'\nOR ZONE_SUBTY = 'ADMINISTRATIVE FLOODWAY' OR ZONE_SUBTY IS NULL OR ZONE_SUBTY NOT LIKE '%FLOODWAY%' AND ZONE_SUBTY <> '1100')\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'AREA OF MINIMAL FLOOD HAZARD' AND ZONE_SUBTY <> '0.2 PCT ANNUAL CHANCE FLOOD HAZARD'))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY NOT IN ('1240','RIVERINE FLOODWAY SHOWN IN COASTAL ZONE','COMBINED RIVERINE AND COASTAL FLOODPLAIN','RIVERINE FLOODPLAIN IN COASTAL AREA','RIVERINE FLOODWAY IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT Annual Chance Flood Hazard in Coastal Zone','RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN STRUCTURE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN CHANNEL', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COASTAL ZONE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM')))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'COASTAL FLOODPLAIN'))\n\nAND (ZONE_SUBTY IS NULL OR (FLD_ZONE <> 'X'))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY IN ('AREA WITH REDUCED FLOOD RISK DUE TO LEVEE','AREA WITH REDUCED FLOOD HAZARD DUE TO ACCREDITED LEVEE SYSTEM','AREA WITH REDUCED FLOOD HAZARD DUE TO PROVISIONALLY ACCREDITED LEVEE SYSTEM') AND (( not STATIC_BFE > 0) or STATIC_BFE is null ) and DEPTH > 0 and ( (not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY LIKE '%FUTURE CONDITIONS%' AND (( not STATIC_BFE > 0) or STATIC_BFE is null ) and DEPTH > 0 and ( (not VELOCITY > 0) or VELOCITY is null))\n\nOR (FLD_ZONE = 'D' AND ZONE_SUBTY = 'AREA WITH UNDETERMINED FLOOD HAZARD DUE TO NONACCREDITED LEVEE SYSTEM' AND (( not STATIC_BFE > 0) or STATIC_BFE is null ) and DEPTH > 0 and ( (not VELOCITY > 0) or VELOCITY is null))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "Depth (no Vel)", + "priority": 8, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "center", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 254, + 254, + 254, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\" && $feature.DEP_REVERT != \"\" && $feature.DEP_REVERT != -9999) {\n return \"\" + $feature.ZONE_SUBTY + \"\" + \"\" + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + \"\" + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\") {\n return \"\" + $feature.ZONE_SUBTY + \"\" + \"\" + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + \"\" + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\"\n}\nelse {\n return $feature.ZONE_SUBTY + TextFormatting.NewLine + \"Zone \" + $feature.FLD_ZONE + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\" \n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "((not STATIC_BFE > 0) or STATIC_BFE is null) and DEPTH > 0 and VELOCITY > 0\n\nAND (ZONE_SUBTY = 'COLORADO RIVER FLOODWAY'\nOR ZONE_SUBTY = 'ADMINISTRATIVE FLOODWAY' OR ZONE_SUBTY IS NULL OR ZONE_SUBTY NOT LIKE '%FLOODWAY%' AND ZONE_SUBTY <> '1100')\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'AREA OF MINIMAL FLOOD HAZARD' AND ZONE_SUBTY <> '0.2 PCT ANNUAL CHANCE FLOOD HAZARD'))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY NOT IN ('1240','RIVERINE FLOODWAY SHOWN IN COASTAL ZONE','COMBINED RIVERINE AND COASTAL FLOODPLAIN','RIVERINE FLOODPLAIN IN COASTAL AREA','RIVERINE FLOODWAY IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE','0.2 PCT Annual Chance Flood Hazard in Coastal Zone','RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN STRUCTURE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN CHANNEL', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COASTAL ZONE', '0.2 PERCENT ANNUAL CHANCE FLOOD HAZARD IN COMBINED RIVERINE AND COASTAL ZONE', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM')))\n\nAND (ZONE_SUBTY IS NULL OR (ZONE_SUBTY <> 'COASTAL FLOODPLAIN'))\n\nAND (ZONE_SUBTY IS NULL OR (FLD_ZONE <> 'X'))\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY LIKE '%FUTURE CONDITIONS%' AND (NOT STATIC_BFE > 0 OR STATIC_BFE IS NULL) AND DEPTH > 0 AND VELOCITY > 0)\n\nOR (FLD_ZONE = 'X' AND ZONE_SUBTY IN ('AREA WITH REDUCED FLOOD RISK DUE TO LEVEE','AREA WITH REDUCED FLOOD HAZARD DUE TO ACCREDITED LEVEE SYSTEM','AREA WITH REDUCED FLOOD HAZARD DUE TO PROVISIONALLY ACCREDITED LEVEE SYSTEM') AND (NOT STATIC_BFE > 0 OR STATIC_BFE IS NULL) AND DEPTH > 0 AND VELOCITY > 0)\n\nOR (FLD_ZONE = 'D' AND ZONE_SUBTY = 'AREA WITH UNDETERMINED FLOOD HAZARD DUE TO NONACCREDITED LEVEE SYSTEM' AND (NOT STATIC_BFE > 0 OR STATIC_BFE IS NULL) AND DEPTH > 0 AND VELOCITY > 0)", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "Depth with Velocity", + "priority": 9, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "center", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 254, + 254, + 254, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T') {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT}\nelse {\n return \"Zone \" + $feature.FLD_ZONE}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "((not STATIC_BFE > 0) or STATIC_BFE is null) and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY IN ('COMBINED RIVERINE AND COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL AREA', 'COASTAL FLOODPLAIN','RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM'))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "No Subtype", + "priority": 3, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "left", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 255, + 255, + 255, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "\"Zone AE\"" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": false, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "ZONE_SUBTY LIKE '%FLOODWAY%'", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "Floodway", + "priority": 4, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "left", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 255, + 255, + 255, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'A') {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \"/\" + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AE' && $feature.BFE_REVERT != -9999) {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\" + \"(EL \" + $feature.BFE_REVERT + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AH') {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == 'AO' && $feature.DEP_REVERT != -9999) {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\"\n}\nelse {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(EL \" + $feature.STATIC_BFE + \")\"\n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": true, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "STATIC_BFE > 0 and STATIC_BFE is not NULL and ((not DEPTH > 0) or DEPTH is null) and ((not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY IN ('COMBINED RIVERINE AND COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL AREA', 'COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM'))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "No Subtype, Static BFE", + "priority": -1, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "left", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 255, + 255, + 255, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\" && $feature.DEP_REVERT != \"\" && $feature.DEP_REVERT != -9999) {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\") {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\"\n}\nelse {\n return \"Zone \" + $feature.FLD_ZONE + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\"\n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": true, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "( (not STATIC_BFE > 0) or STATIC_BFE is null ) and DEPTH > 0 and ( (not VELOCITY > 0) or VELOCITY is null)\n\nAND (ZONE_SUBTY IN ('COMBINED RIVERINE AND COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL AREA', 'COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM'))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "No Subtype, Depth (no Vel)", + "priority": -1, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "left", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 255, + 255, + 255, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + }, + { + "labelExpressionInfo": { + "expression": "if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\" && $feature.DEP_REVERT != \"\" && $feature.DEP_REVERT != -9999) {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + \"(DEPTH \" + $feature.DEP_REVERT + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\"\n}\nelse if ($feature.DUAL_ZONE == 'T' && $feature.AR_REVERT == \"AO\") {\n return \"Zone \" + $feature.FLD_ZONE + \"/\" + $feature.AR_REVERT + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\"\n}\nelse {\n return \"Zone \" + $feature.FLD_ZONE + TextFormatting.NewLine + \"(DEPTH \" + $feature.DEPTH + \")\" + TextFormatting.NewLine + \"(VEL \" + $feature.VELOCITY + \" FPS\" + \")\"\n}" + }, + "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal", + "multiPart": "labelLargest", + "allowOverrun": true, + "deconflictionStrategy": "static", + "repeatLabel": false, + "stackLabel": true, + "stackRowLength": 24, + "stackAlignment": "dynamic", + "removeDuplicates": "all", + "removeDuplicatesDistance": 150, + "where": "((not STATIC_BFE > 0) or STATIC_BFE is null) and DEPTH > 0 and VELOCITY > 0\n\nAND (ZONE_SUBTY IN ('COMBINED RIVERINE AND COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL AREA', 'COASTAL FLOODPLAIN', 'RIVERINE FLOODPLAIN IN COASTAL ZONE', 'RIVERINE FLOODPLAIN IN COASTAL ZONE2', 'AREA WITH FLOOD HAZARD DUE TO LEVEE SYSTEM', 'AREA WITH REDUCED FLOOD HAZARD DUE TO LEVEE SYSTEM'))", + "useCodedValues": true, + "maxScale": 0, + "minScale": 18055.954822, + "name": "No Subtype, Depth with Velocity", + "priority": -1, + "symbol": { + "type": "esriTS", + "color": [ + 0, + 0, + 0, + 255 + ], + "backgroundColor": null, + "borderLineColor": null, + "borderLineSize": null, + "verticalAlignment": "bottom", + "horizontalAlignment": "left", + "rightToLeft": false, + "angle": 0, + "xoffset": 0, + "yoffset": 0, + "kerning": true, + "haloColor": [ + 255, + 255, + 255, + 255 + ], + "haloSize": 1, + "font": { + "family": "Arial", + "size": 9, + "style": "normal", + "weight": "normal", + "decoration": "none" + } + } + } + ] +} \ No newline at end of file diff --git a/src/nfhl/main.py b/src/nfhl/main.py index c0d5922..b6394c3 100644 --- a/src/nfhl/main.py +++ b/src/nfhl/main.py @@ -12,9 +12,8 @@ from types import SimpleNamespace import arcgis -from palletjack import ( - FeatureServiceAttachmentsUpdater, FeatureServiceInlineUpdater, GoogleDriveDownloader, GSheetLoader -) +from palletjack import extract, load, transform, utils +import pandas as pd from supervisor.message_handlers import SendGridHandler from supervisor.models import MessageDetails, Supervisor @@ -118,6 +117,83 @@ def _remove_log_file_handlers(log_name, loggers): except Exception as error: pass + +def _hazard_areas(hazard_areas_df): + #: Calculate label values for symbology + one_per_annual_flood_dq = (hazard_areas_df['FLD_ZONE'].isin(['A', 'AE', 'AH', 'AO', 'VE'] + )) & (hazard_areas_df['ZONE_SUBTY'].isnull()) + regulatory_floodway_dq = (hazard_areas_df['FLD_ZONE'] == 'AE' + ) & (hazard_areas_df['ZONE_SUBTY'].isin(['FLOODWAY', 'FLOODWAY CONTAINED IN CHANNEL'])) + undet_flood_hazard_dq = (hazard_areas_df['FLD_ZONE'] == 'D') + point_oh_two_percent_annual_flood_dq = (hazard_areas_df['FLD_ZONE'] == 'X') & ( + hazard_areas_df['ZONE_SUBTY'].isin([ + '0.2 PCT ANNUAL CHANCE FLOOD HAZARD', '1 PCT DEPTH LESS THAN 1 FOOT', + '1 PCT DRAINAGE AREA LESS THAN 1 SQUARE MILE' + ]) + ) + reduced_risk_levee_dq = (hazard_areas_df['FLD_ZONE'] + == 'X') & (hazard_areas_df['ZONE_SUBTY'] == 'AREA WITH REDUCED FLOOD RISK DUE TO LEVEE') + area_not_included_dq = (hazard_areas_df['FLD_ZONE'] == 'AREA NOT INCLUDED') + + hazard_areas_df['label'] = '' + hazard_areas_df.loc[one_per_annual_flood_dq, 'label'] = '1% Annual Chance Flood Hazard' + hazard_areas_df.loc[regulatory_floodway_dq, 'label'] = 'Regulatory Floodway' + hazard_areas_df.loc[undet_flood_hazard_dq, 'label'] = 'Area of Undetermined Flood Hazard' + hazard_areas_df.loc[point_oh_two_percent_annual_flood_dq, 'label'] = '0.2% Annual Chance Flood Hazard' + hazard_areas_df.loc[reduced_risk_levee_dq, 'label'] = 'Area with Reduced Flood Risk due to Levee' + hazard_areas_df.loc[area_not_included_dq, 'label'] = 'Area Not Included' + + #: fill null strings with empty string '' to fix featureset error + for col in hazard_areas_df.columns: + if hazard_areas_df[col].dtype == 'string': + hazard_areas_df[col].fillna('', inplace=True) + + return hazard_areas_df + + +def _operate_on_layer(module_logger, tempdir, gis, fema_extractor, layer): + + module_logger.info('Extracting %s...', layer['name']) + service_layer = extract.ServiceLayer( + f'{fema_extractor.url}/{layer["number"]}', timeout=config.TIMEOUT, where_clause='DFIRM_ID LIKE \'49%\'' + ) + layer_df = fema_extractor.get_features(service_layer) + + module_logger.info('Transforming %s...', layer['name']) + if layer['name'] == 'S_Fld_Haz_Ar': + layer_df = _hazard_areas(layer_df) + + #: make columns match + layer_df.columns = [col.lower() if col not in ['SHAPE', 'OBJECTID'] else col for col in layer_df.columns] + layer_df.rename(columns={'globalid': 'global_id'}, inplace=True) + layer_df.drop(columns=['shape.stlength()', 'shape.starea()'], errors='ignore', inplace=True) + + #: Fix various field types if the layer has them set + for method, list_name in zip([ + transform.DataCleaning.switch_to_datetime, transform.DataCleaning.switch_to_float, + transform.DataCleaning.switch_to_nullable_int + ], ['date_fields', 'double_fields', 'int_fields']): + try: + layer_df = method(layer_df, layer[list_name]) + except KeyError: + pass + + module_logger.info('Loading %s...', layer['name']) + feature_layer = load.FeatureServiceUpdater(gis, layer['itemid'], tempdir) + features_loaded = feature_layer.truncate_and_load_features(layer_df, save_old=True) + return features_loaded + + +def _update_hazard_layer_symbology(gis): + layer_item = gis.content.get(config.FEMA_LAYERS['S_Fld_Haz_Ar']['itemid']) + layer_data = layer_item.get_data() + json_path = (Path(__file__).parent / 'fld_haz_ar_drawingInfo.json') + with json_path.open('r', encoding='utf-8') as symbology_file: + layer_data['layers'][0]['layerDefinition']['drawingInfo'] = json.load(symbology_file) + result = utils.retry(layer_item.update, item_properties={'text': json.dumps(layer_data)}) + return result + + def process(): """The main function that does all the work. """ @@ -133,14 +209,27 @@ def process(): log_path = tempdir_path / log_name skid_supervisor = _initialize(log_path, secrets.SENDGRID_API_KEY) - module_logger = logging.getLogger(config.SKID_NAME) - #: Get our GIS object via the ArcGIS API for Python gis = arcgis.gis.GIS(config.AGOL_ORG, secrets.AGOL_USER, secrets.AGOL_PASSWORD) + fema_extractor = extract.RESTServiceLoader(config.SERVICE_URL, timeout=config.TIMEOUT) + module_logger = logging.getLogger(config.SKID_NAME) - ######################################################################### - #: Use the various palletjack classes and other code to do your work here - ######################################################################### + feature_counts = {} + + for name, layer in config.FEMA_LAYERS.items(): + try: + features_loaded = utils.retry(_operate_on_layer, module_logger, tempdir, gis, fema_extractor, layer) + except Exception: + module_logger.exception('Error loading %s', name) + features_loaded = 'error' + feature_counts[name] = features_loaded + + module_logger.info('Updating hazard area symbology...') + try: + hazard_area_result = _update_hazard_layer_symbology(gis) + except Exception: + module_logger.exception('Error updating hazard area symbology') + hazard_area_result = False end = datetime.now() @@ -153,9 +242,10 @@ def process(): f'Start time: {start.strftime("%H:%M:%S")}', f'End time: {end.strftime("%H:%M:%S")}', f'Duration: {str(end-start)}', - #: Add other rows here containing summary info captured/calculated during the working portion of the skid, - #: like the number of rows updated or the number of successful attachment overwrites. + 'Update Counts:', ] + summary_rows.extend([f'{name}: {count}' for name, count in feature_counts.items()]) + summary_rows.append(f'Hazard Area Symbology Updated: {hazard_area_result}') summary_message.message = '\n'.join(summary_rows) summary_message.attachments = tempdir_path / log_name @@ -167,8 +257,6 @@ def process(): _remove_log_file_handlers(log_name, loggers) - - def main(event, context): # pylint: disable=unused-argument """Entry point for Google Cloud Function triggered by pub/sub event @@ -198,6 +286,7 @@ def main(event, context): # pylint: disable=unused-argument #: Call process() and any other functions you want to be run as part of the skid here. process() + #: Putting this here means you can call the file via `python main.py` and it will run. Useful for pre-GCF testing. if __name__ == '__main__': process() diff --git a/src/nfhl/requirements.txt b/src/nfhl/requirements.txt new file mode 100644 index 0000000..59c06b3 --- /dev/null +++ b/src/nfhl/requirements.txt @@ -0,0 +1,8 @@ +agrc-supervisor==3.0.* +ugrc-palletjack==4.0.* +google-cloud-storage==2.3.* +arcgis==2.1.0.3 +jupyterlab==3.6.5 +jupyter-server==1.24.0 +ipykernel==6.24.0 +ypy-websocket==0.8.2