-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,613 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import L from "leaflet"; | ||
import 'esri-leaflet'; | ||
import { vectorBasemapLayer } from "esri-leaflet-vector"; | ||
import { useMap } from "react-leaflet"; | ||
import { config } from "../config"; | ||
|
||
export default function BaseMap(props) { | ||
const map = useMap(); | ||
const apiKey = config.agolApiKey; | ||
vectorBasemapLayer("arcgis/dark-gray", { | ||
apikey: apiKey | ||
}).addTo(map); | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import InputLabel from '@mui/material/InputLabel'; | ||
import MenuItem from '@mui/material/MenuItem'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import Select from '@mui/material/Select'; | ||
import { config } from '../config'; | ||
|
||
export default function BasicSelect(props) { | ||
const { selectedLayer, setSelectedLayer } = props; | ||
|
||
const handleChange = (event) => { | ||
layer = event.target.value; | ||
layer.layer = layer.layer.concat('currentMaskForForest'); | ||
setSelectedLayer(layer); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ minWidth: 120 }}> | ||
<FormControl fullWidth> | ||
<InputLabel id="demo-simple-select-label">Select Layer</InputLabel> | ||
<Select | ||
labelId="demo-simple-select-label" | ||
id="demo-simple-select" | ||
value={selectedLayer} | ||
label="Layer" | ||
onChange={handleChange} | ||
> | ||
{config.wmsLayers.map((layer, index) => ( | ||
<MenuItem key={index} value={layer}> | ||
{layer.name} | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { useState } from "react"; | ||
import { MapContainer, WMSTileLayer } from "react-leaflet"; | ||
import L from "leaflet"; | ||
import { styled } from "@mui/system"; | ||
import BaseMap from "./BaseMap"; | ||
import { config } from "../config"; | ||
import VectorBasemapLayer from "react-esri-leaflet/plugins/VectorBasemapLayer"; | ||
|
||
export const StyledMapContainer = styled(MapContainer)(({ theme }) => ({ | ||
height: "800px", | ||
})); | ||
|
||
export default function ReactLeafletMap(props) { | ||
const { selectedLayer } = props; | ||
|
||
return ( | ||
<StyledMapContainer | ||
center={config.mapCenter} | ||
zoom={config.mapZoom} | ||
> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/leaflet@latest/dist/leaflet.css" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/esri-leaflet-geocoder/dist/esri-leaflet-geocoder.css" | ||
/> | ||
{selectedLayer && ( | ||
<WMSTileLayer | ||
key={selectedLayer.layer} | ||
url={selectedLayer.url} | ||
layers={selectedLayer.layer} | ||
format="image/png" | ||
transparent={true} | ||
uppercase={true} | ||
opacity={1} | ||
/> | ||
)} | ||
<VectorBasemapLayer name="arcgis/dark-gray" token={config.agolApiKey} /> | ||
</StyledMapContainer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { isLeapYear } from './utils' | ||
|
||
const wmsBaseUrl = 'https://fswms.nemac.org/' | ||
const date = new Date(); | ||
const year = date.getFullYear(); | ||
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based in JavaScript | ||
const day = String(date.getDate()).padStart(2, '0'); | ||
|
||
export const config = { | ||
agolApiKey: 'AAPK961d021a9f344f7c95eaadbeb6c6f39ajXC7QTZMufrPPCzqo0NN_ta6FKKzOb8GDutDr1ipDWZMVMPT-Mgy4CNcnKIXJTdu', | ||
mapCenter: [37.0902, -95.7129], | ||
mapZoom: 6, | ||
projectName: 'New FCAV', | ||
monthDay: `${month}${day}`, // current month and day | ||
yearMonthDay: `${year}${month}${day}`, // current year, month, and day | ||
leapYear: isLeapYear(year), // checks if leap year | ||
dateStart: '0103', | ||
nonLeapYearDays: [ | ||
'0108', | ||
'0116', | ||
'0124', | ||
'0201', | ||
'0209', | ||
'0217', | ||
'0225', | ||
'0305', | ||
'0313', | ||
'0321', | ||
'0329', | ||
'0406', | ||
'0414', | ||
'0422', | ||
'0430', | ||
'0508', | ||
'0516', | ||
'0524', | ||
'0601', | ||
'0609', | ||
'0617', | ||
'0625', | ||
'0703', | ||
'0711', | ||
'0719', | ||
'0727', | ||
'0804', | ||
'0812', | ||
'0820', | ||
'0828', | ||
'0905', | ||
'0913', | ||
'0921', | ||
'0929', | ||
'1007', | ||
'1015', | ||
'1023', | ||
'1031', | ||
'1108', | ||
'1116', | ||
'1124', | ||
'1202', | ||
'1210', | ||
'1218', | ||
'1226', | ||
], | ||
leapYearDays: [ | ||
'0108', | ||
'0116', | ||
'0124', | ||
'0201', | ||
'0209', | ||
'0217', | ||
'0225', | ||
'0304', | ||
'0312', | ||
'0320', | ||
'0328', | ||
'0405', | ||
'0413', | ||
'0421', | ||
'0429', | ||
'0507', | ||
'0515', | ||
'0523', | ||
'0531', | ||
'0608', | ||
'0616', | ||
'0624', | ||
'0702', | ||
'0710', | ||
'0718', | ||
'0726', | ||
'0803', | ||
'0811', | ||
'0819', | ||
'0827', | ||
'0904', | ||
'0912', | ||
'0920', | ||
'0928', | ||
'1006', | ||
'1014', | ||
'1022', | ||
'1030', | ||
'1107', | ||
'1115', | ||
'1123', | ||
'1201', | ||
'1209', | ||
'1217', | ||
'1225', | ||
], | ||
wmsLayers: [ | ||
{ | ||
name: 'From Seasonal Progress Adaptive Baseline "Normal', | ||
url: wmsBaseUrl.concat('forwarn3'), | ||
layer: `FW3_adaptivebaseline_allyr_`, | ||
dayStart:'0108', | ||
yearStart: '2021' | ||
}, | ||
{ | ||
name: 'Early Detect From 8-day Two-Year Maximum Baseline "Normal', | ||
url: wmsBaseUrl.concat('forwarn3'), | ||
layer: 'FW3_ED_', | ||
dayStart:'0108', | ||
yearStart: '2021' | ||
} | ||
|
||
] | ||
} |
Oops, something went wrong.