Skip to content

Commit

Permalink
decrease min zoom, forecast toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhales committed Jul 19, 2024
1 parent dab4d11 commit 5d3ed59
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ requirements:
- cf-staging
- defaults
packages:
- geoglows>=1.6
- geoglows>=1.7
- natsort
- plotly

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name=release_package,
version='1.0.0',
version='1.1.0',
description='Graphical interface for the GEOGLOWS Hydrologic Model Version 2',
long_description='',
keywords='',
Expand Down
25 changes: 17 additions & 8 deletions tethysapp/hydroviewer/public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const app = (() => {
let REACHID
let mapMarker = null

const MIN_QUERY_ZOOM = 12

//////////////////////////////////////////////////////////////////////// ESRI Map
const mapObj = L.map("map", {
zoom: 3,
minZoom: 2,
maxZoom: 15,
boxZoom: true,
maxBounds: L.latLngBounds(L.latLng(-100, -225), L.latLng(100, 225)),
center: [20, 0]
Expand Down Expand Up @@ -142,12 +145,14 @@ const app = (() => {
.addTo(mapObj)

mapObj.on("click", event => {
if (mapObj.getZoom() < 16) {
mapObj.flyTo(event.latlng, 16)
if (mapObj.getZoom() < MIN_QUERY_ZOOM) {
mapObj.flyTo(event.latlng, MIN_QUERY_ZOOM, {duration: 0.5})
mapObj.fire('zoomend')
return
}
mapObj.flyTo(event.latlng)
mapObj.panTo(event.latlng)
mapObj.fire('zoomend')
mapObj.fire('moveend')

if (mapMarker) mapObj.removeLayer(mapMarker)
mapMarker = L.marker(event.latlng).addTo(mapObj)
Expand All @@ -168,10 +173,14 @@ const app = (() => {
alert("Error finding the reach_id")
return
}
updateStatusIcons({reachid: "ready"})
selectedSegment.clearLayers()
selectedSegment.addData(featureCollection.features[0].geometry)
REACHID = featureCollection.features[0].properties["TDX Hydro Link Number"]
if (REACHID === "Null") {
updateStatusIcons({reachid: "fail"})
alert("Error finding the reach_id")
return
}
selectedSegment.addData(featureCollection.features[0].geometry)
fetchData(REACHID)
})
})
Expand All @@ -182,7 +191,7 @@ const app = (() => {
updateStatusIcons({reachid: "ready", forecast: "clear", retro: "clear"})
$("#chart_modal").modal("show")
clearChartDivs()
getForecastData()
document.getElementById('auto-load-forecasts').checked ? getForecastData() : giveForecastRetryButton(REACHID)
document.getElementById('auto-load-retrospective').checked ? getRetrospectiveData() : giveRetrospectiveRetryButton(REACHID)
}
const findReachID = () => {
Expand All @@ -193,7 +202,7 @@ const app = (() => {
success: response => {
if (mapMarker) mapObj.removeLayer(mapMarker)
mapMarker = L.marker(L.latLng(response.lat, response.lon)).addTo(mapObj)
mapObj.flyTo(L.latLng(response["lat"], response["lon"]), 9)
mapObj.flyTo(L.latLng(response["lat"], response["lon"]), MIN_QUERY_ZOOM)
},
error: () => alert("Unable to find that reach_id. Please check the number and try again.")
})
Expand All @@ -219,7 +228,7 @@ const app = (() => {
.split(",")
if (mapMarker) mapObj.removeLayer(mapMarker)
mapMarker = L.marker(L.latLng(ll[0], ll[1])).addTo(mapObj)
mapObj.flyTo(L.latLng(ll[0], ll[1]), 9)
mapObj.flyTo(L.latLng(ll[0], ll[1]), MIN_QUERY_ZOOM)
}

//////////////////////////////////////////////////////////////////////// UPDATE DOWNLOAD LINKS FUNCTION
Expand Down
6 changes: 5 additions & 1 deletion tethysapp/hydroviewer/templates/hydroviewer/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
<a class="btn btn-light mybtn" role="button" onclick="app.clearMarkers()">Remove Map Marker</a>
<hr>
<div style="display: flex; justify-content: space-between; align-items: center">
<label class="control-label" for="slider">Show Retrospective</label>
<label class="control-label" for="auto-load-forecasts">Retrieve Forecast</label>
<input type="checkbox" id="auto-load-forecasts" style="height: 1rem; width: 1rem" checked>
</div>
<div style="display: flex; justify-content: space-between; align-items: center">
<label class="control-label" for="auto-load-retrospective">Retrieve Retrospective</label>
<input type="checkbox" id="auto-load-retrospective" style="height: 1rem; width: 1rem" checked>
</div>
<hr>
Expand Down

0 comments on commit 5d3ed59

Please sign in to comment.