From 5957d2131a25e14139a95a9c8acd91c75fffc3e7 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Tue, 10 Dec 2024 14:06:10 -0500 Subject: [PATCH] fix link slashes and move to root of GeoJSON (#357) --- msc_pygeoapi/loader/hydat.py | 76 ++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/msc_pygeoapi/loader/hydat.py b/msc_pygeoapi/loader/hydat.py index e87618a8..58f6f6ac 100644 --- a/msc_pygeoapi/loader/hydat.py +++ b/msc_pygeoapi/loader/hydat.py @@ -658,7 +658,7 @@ def generate_stations(self, station_table, annual_peaks_table, :returns: generator of bulk API upsert actions. """ - url = MSC_PYGEOAPI_OGC_API_URL + url = MSC_PYGEOAPI_OGC_API_URL.rstrip('/') station_codes = [ x[0] @@ -745,54 +745,54 @@ def generate_stations(self, station_table, annual_peaks_table, 'STATUS_FR': status_fr, 'CONTRIBUTOR_EN': agency_en, 'CONTRIBUTOR_FR': agency_fr, - 'VERTICAL_DATUM': datum_en, - 'links': [ - { - 'type': 'text/html', - 'rel': 'related', - 'title': f'Station Information for {station_name} ({station})', # noqa - 'href': f'{url}/collections/hydrometric-stations/items?STATION_NUMBER={station}&f=html', # noqa - }, - { - 'type': 'application/json', - 'rel': 'related', - 'title': f'Daily Mean of Water Level or Discharge for {station_name} ({station})', # noqa - 'href': f'{url}/collections/hydrometric-daily-mean/items?STATION_NUMBER={station}', # noqa - }, - { - 'type': 'application/json', - 'rel': 'related', - 'title': f'Monthly Mean of Water Level or Discharge for {station_name} ({station})', # noqa - 'href': f'{url}/collections/hydrometric-monthly-mean/items?STATION_NUMBER={station}', # noqa - }, - { - 'type': 'text/html', - 'rel': 'alternate', - 'title': f'Station Information for {station_name} ({station})', # noqa - 'href': f'https://wateroffice.ec.gc.ca/report/historical_e.html?stn={station}', # noqa - 'hreflang': 'en-CA', - }, - { - 'type': 'text/html', - 'rel': 'alternate', - 'title': f'Informations pour la station {station_name} ({station})', # noqa - 'href': f'https://wateroffice.ec.gc.ca/report/historical_f.html?stn={station}', # noqa - 'hreflang': 'fr-CA', - }, - ], + 'VERTICAL_DATUM': datum_en }, + 'links': [ + { + 'type': 'text/html', + 'rel': 'related', + 'title': f'Station Information for {station_name} ({station})', # noqa + 'href': f'{url}/collections/hydrometric-stations/items?STATION_NUMBER={station}&f=html', # noqa + }, + { + 'type': 'application/json', + 'rel': 'related', + 'title': f'Daily Mean of Water Level or Discharge for {station_name} ({station})', # noqa + 'href': f'{url}/collections/hydrometric-daily-mean/items?STATION_NUMBER={station}', # noqa + }, + { + 'type': 'application/json', + 'rel': 'related', + 'title': f'Monthly Mean of Water Level or Discharge for {station_name} ({station})', # noqa + 'href': f'{url}/collections/hydrometric-monthly-mean/items?STATION_NUMBER={station}', # noqa + }, + { + 'type': 'text/html', + 'rel': 'alternate', + 'title': f'Station Information for {station_name} ({station})', # noqa + 'href': f'https://wateroffice.ec.gc.ca/report/historical_e.html?stn={station}', # noqa + 'hreflang': 'en-CA', + }, + { + 'type': 'text/html', + 'rel': 'alternate', + 'title': f'Informations pour la station {station_name} ({station})', # noqa + 'href': f'https://wateroffice.ec.gc.ca/report/historical_f.html?stn={station}', # noqa + 'hreflang': 'fr-CA', + }, + ], 'geometry': {'type': 'Point', 'coordinates': station_coords}, } if len(peaks) > 0: - insert_dict['properties']['links'].append({ + insert_dict['links'].append({ 'type': 'application/json', 'rel': 'related', 'title': f'Annual Maximum and Minimum Instantaneous Water Level or Discharge for {station_name} ({station})', # noqa 'href': f'{url}/collections/hydrometric-annual-peaks/items?STATION_NUMBER={station}', # noqa }) if len(stats) > 0: - insert_dict['properties']['links'].append({ + insert_dict['links'].append({ 'type': 'application/json', 'rel': 'related', 'title': f'Annual Maximum and Minimum Daily Water Level or Discharge for {station_name} ({station})', # noqa