diff --git a/src/components/map/adcirc-raster-layer.js b/src/components/map/adcirc-raster-layer.js index 8d5d07e..7c17545 100644 --- a/src/components/map/adcirc-raster-layer.js +++ b/src/components/map/adcirc-raster-layer.js @@ -1,8 +1,8 @@ -import React, {useEffect, useMemo, useState, useCallback} from 'react'; -import {WMSTileLayer, useMap, useMapEvent} from 'react-leaflet'; +import React, { useEffect, useMemo, useState, useCallback } from 'react'; +import { WMSTileLayer, useMap, useMapEvent } from 'react-leaflet'; import SldStyleParser from 'geostyler-sld-parser'; -import {getNamespacedEnvParam, markClicked, restoreColorMapType} from '@utils/map-utils'; -import {useLayers, useSettings} from '@context'; +import { getNamespacedEnvParam, markClicked, restoreColorMapType } from '@utils/map-utils'; +import { useLayers, useSettings } from '@context'; const MAXELE = 'maxele'; const MAXWVEL = 'maxwvel'; @@ -109,16 +109,19 @@ export const AdcircRasterLayer = (layer) => { // get the FQDN of the UI data server const data_url = `${getNamespacedEnvParam('REACT_APP_UI_DATA_URL')}`; + // split the URL + const split_url = layer.properties['tds_download_url'].split('/'); + + // generate the base TDS svr hostname/url + const tds_svr = split_url[0] + '//' + split_url[2] + '/thredds'; + // create the correct TDS URL without the hostname const tds_url = layer.properties['tds_download_url'].replace('catalog', 'dodsC').replace('catalog.html', (layer.id.indexOf('swan') < 0 ? 'fort' : 'swan_HS') + '.63.nc').split('/thredds')[1]; - // get the hostname - const tds_svr = layer.properties['tds_download_url'].split('https://')[1].split('/thredds')[0].split('.')[0]; - // generate the full url - const fullTDSURL = data_url + "get_geo_point_data?lon=" + e.latlng.lng + "&lat=" + e.latlng.lat + "&ensemble=nowcast&url=" + - tds_url + '&tds_svr=' + tds_svr; + const fullTDSURL = data_url + "get_geo_point_data?lon=" + e.latlng.lng + "&lat=" + e.latlng.lat + "&ensemble=nowcast" + + '&tds_svr=' + tds_svr + '&url=' + tds_url; const l_props = layer.properties; diff --git a/src/components/side-by-side/leaflet-side-by-side.js b/src/components/side-by-side/leaflet-side-by-side.js index a3f20e1..7be6f24 100644 --- a/src/components/side-by-side/leaflet-side-by-side.js +++ b/src/components/side-by-side/leaflet-side-by-side.js @@ -1,3 +1,9 @@ +/** + * All credit for this code goes to the people involved at Digital Democracy (https://www.digital-democracy.org/) + * + * original source can be found here: https://github.com/digidem/leaflet-side-by-side + */ + (function () { function r(e, n, t) { function o(i, f) {