Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize tds url #305

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/components/map/adcirc-raster-layer.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions src/components/side-by-side/leaflet-side-by-side.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down