HWR-llc / ett

MassBays Phase I data explorer for data from the EPA WQX Portal
MIT License
1 stars 1 forks source link

Add NOAA Nautical Charts basemap #77

Closed walkerjeffd closed 9 months ago

walkerjeffd commented 2 years ago

I found a new nautical charts basemap here: https://nauticalcharts.noaa.gov/data/gis-data-and-services.html#enc-display-services

I just tried it on a basic leaflet map, and got it to work with this configuration:

{
  url: 'https://gis.charttools.noaa.gov/arcgis/rest/services/MCS/ENCOnline/MapServer/exts/MaritimeChartService/WMSServer',
  name: 'NOAA Nautical Charts',
  visible: true,
  format: 'image/png',
  transparent: true,
  attribution: '<a href="https://nauticalcharts.noaa.gov/data/gis-data-and-services.html" _target="_blank">NOAA Maritime Chart Service</a>'
}

The one hitch is that you need to add it using the WMS Tile Layer (l-wms-tile-layer) instead of a regular Tile Layer (l-tile-layer).

Probably easiest to add a second list of basemaps in /lib/constants.js (e.g., basemapsWms) that would just have this one in it, then add the <l-wms-tile-layer> below the <l-tile-layer> in the MapView component.

It's definitely slower than the other basemaps, but there's nothing we can do about it on our end.

HWR-llc commented 2 years ago

Thanks this works. It looks like there is no way to set which layer is the default basemap without writing a function that retrieves the layer control after the HTML is created. I did not want to have the NOAA Nautical chart be shown as the starting basemap, and ideally it would also not be the first layer shown in the layer control box. My only option was to sort layers, but that seems to make things worse.

The nautical charts are the top entry, but not shown by default when the map loads.