Skip to content
Snippets Groups Projects
Commit c5c3627d authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

add new vecotr tile layers

parent fa69a407
No related branches found
No related tags found
1 merge request!245Vector maps
/**
* Base layers for mapping.
*
* These base layers map to concrete styles in lib/state/map/map.utils.
*/
export enum MapBaseLayer {
/**
* Esri hillshade.
* @see https://doc.arcgis.com/en/data-appliance/2022/maps/world-hillshade.htm
*/
HILLSHADE = 'Hillshade',
/**
* Esri dark hillshade.
* @see https://doc.arcgis.com/en/data-appliance/2022/maps/world-hillshade-dark.htm
*/
HILLSHADE_DARK = 'Hillshade Dark',
/**
* Esri ocean map.
* @see https://doc.arcgis.com/en/data-appliance/2022/maps/world-ocean-base.htm
*/
ENHANCED_CONTRAST = 'Enhanced Contrast',
ENHANCED_CONTRAST_DARK = 'Enhanced Contrast Dark',
OCEAN = 'Ocean',
/**
* Esri physical map
* @see https://doc.arcgis.com/en/data-appliance/2022/maps/world-physical-map.htm
*/
PHYSICAL = 'Physical',
/**
* Esri satellite map.
* @see https://doc.arcgis.com/en/data-appliance/2022/maps/world-imagery.htm
*/
OUTDOOR = 'Outdoor',
SATELLITE = 'Satellite',
/**
* USGS topographic map.
*
* @see https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer
*/
USGS_TOPO = 'USGS Topographic',
STREET = 'Street',
TOPO = 'Topographic',
}
import {vectorTileLayer} from 'esri-leaflet-vector';
import * as geojson from 'geojson';
import * as L from 'leaflet';
import {Location} from '../nshmp-lib/geo';
import {MapBaseLayer} from './map-baselayer.model';
import {VectorId} from './vector-id.model';
/** Location transform */
export type LocationTransform = (location: Location) => Location;
......@@ -12,74 +14,73 @@ export type LocationTransform = (location: Location) => Location;
*
* https://doc.arcgis.com/en/data-appliance/latest/maps/directory-maps-data.htm
*/
export function baseLayers(): Record<MapBaseLayer, L.TileLayer> {
const baseLayers: Record<MapBaseLayer, L.TileLayer> = {
/* Esri world hillshade */
[MapBaseLayer.HILLSHADE]: L.tileLayer(
`${ARCGIS_URL_START}Elevation/World_Hillshade${ARCGIS_URL_END}`,
{
export function baseLayers(): Record<MapBaseLayer, L.LayerGroup> {
const baseLayers: Record<MapBaseLayer, L.LayerGroup> = {
// https://maps.arcgis.com/sharing/rest/content/items/83aeff137ea54be986e568fe206376d5/data
[MapBaseLayer.ENHANCED_CONTRAST]: L.layerGroup([
vectorTileLayer(VectorId.ENHANCED_CONTRAST_BASE, {
...OPTIONS,
attribution:
'Esri, USGS, NGA, NASA, CGIAR, N Robinson, NCEAS, NLS, OS, NMA, ' +
'Geodatastyrelsen, Rijkswaterstaat, GSA, Geoland, FEMA, Intermap, ' +
'and the GIS user community',
id: MapBaseLayer.HILLSHADE,
}
),
/* Esri world hillshade */
[MapBaseLayer.HILLSHADE_DARK]: L.tileLayer(
`${ARCGIS_URL_START}Elevation/World_Hillshade_Dark${ARCGIS_URL_END}`,
{
id: MapBaseLayer.ENHANCED_CONTRAST,
}),
vectorTileLayer(VectorId.ENHANCED_CONTRAST_REFERENCE, {
...OPTIONS,
attribution:
'Esri, USGS, NGA, NASA, CGIAR, N Robinson, NCEAS, NLS, OS, NMA, ' +
'Geodatastyrelsen, Rijkswaterstaat, GSA, Geoland, FEMA, Intermap, ' +
'and the GIS user community',
id: MapBaseLayer.HILLSHADE_DARK,
}
),
/* Esri world ocean */
[MapBaseLayer.OCEAN]: L.tileLayer(
`${ARCGIS_URL_START}Ocean/World_Ocean_Base${ARCGIS_URL_END}`,
{
id: MapBaseLayer.ENHANCED_CONTRAST,
}),
]),
// https://maps.arcgis.com/sharing/rest/content/items/bb6c3aa9f44e444a8f5de18030f6b4be/data
[MapBaseLayer.ENHANCED_CONTRAST_DARK]: L.layerGroup([
vectorTileLayer(VectorId.ENHANCED_CONTRAST_BASE_DARK, {
...OPTIONS,
id: MapBaseLayer.ENHANCED_CONTRAST_DARK,
}),
vectorTileLayer(VectorId.ENHANCED_CONTRAST_REFERENCE_DARK, {
...OPTIONS,
id: MapBaseLayer.ENHANCED_CONTRAST_DARK,
}),
]),
// https://maps.arcgis.com/sharing/rest/content/items/33d6280d276d4af89fb66a6ffa7f2072/data
[MapBaseLayer.OCEAN]: L.layerGroup([
vectorTileLayer(VectorId.OCEAN, {
...OPTIONS,
attribution: 'Esri, Garmin, GEBCO, NOAA NGDC, and other contributors',
id: MapBaseLayer.OCEAN,
maxZoom: 10,
}
),
/* Esri world physical map */
[MapBaseLayer.PHYSICAL]: L.tileLayer(
`${ARCGIS_URL_START}World_Physical_Map${ARCGIS_URL_END}`,
{
}),
L.tileLayer(arcUrl('Ocean/World_Ocean_Base'), {
...OPTIONS,
attribution: 'U.S. National Park Service',
id: MapBaseLayer.PHYSICAL,
maxZoom: 8,
}
),
[MapBaseLayer.SATELLITE]: L.tileLayer(
`${ARCGIS_URL_START}World_Imagery${ARCGIS_URL_END}`,
{
id: MapBaseLayer.OCEAN,
}),
]),
// https://maps.arcgis.com/sharing/rest/content/items/e128f7554370429c91ef7c0e260c078a/data
[MapBaseLayer.OUTDOOR]: vectorTileLayer(VectorId.OUTDOOR, {
...OPTIONS,
id: MapBaseLayer.OUTDOOR,
}),
// https://maps.arcgis.com/sharing/rest/content/items/0d17ba68a8f64c278e7e2e7864e1069d/data
[MapBaseLayer.SATELLITE]: L.layerGroup([
vectorTileLayer(VectorId.SATELLITE, {
...OPTIONS,
attribution:
'Esri, Maxar, Earthstar Geographics, and the GIS User Community',
id: MapBaseLayer.SATELLITE,
}
),
[MapBaseLayer.USGS_TOPO]: L.tileLayer(
'https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}',
{
}),
L.tileLayer(arcUrl('World_Imagery'), {
...OPTIONS,
attribution: `Esri, USGS | Esri, TomTom, FAO, NOAA, USGS | USGS The National Map: National Boundaries
Dataset, 3DEP Elevation Program, Geographic Names Information System, National Hydrography
Dataset, National Land Cover Database, National Structures Dataset, and National
Transportation Dataset; USGS Global Ecosystems; U.S. Census Bureau TIGER/Line data;
USFS Road data; Natural Earth Data; U.S. Department of State HIU; NOAA National
Centers for Environmental Information. Data refreshed February, 2025.`,
id: MapBaseLayer.USGS_TOPO,
}
),
id: MapBaseLayer.SATELLITE,
}),
]),
// https://maps.arcgis.com/sharing/rest/content/items/22fb75c0fa5a4c88b8ca4c4b8ae5c90b/data
[MapBaseLayer.STREET]: vectorTileLayer(VectorId.STREET, {
...OPTIONS,
id: MapBaseLayer.STREET,
}),
// https://maps.arcgis.com/sharing/rest/content/items/8d57f09b9df345e79945f0f3da1d4d0f/data
[MapBaseLayer.TOPO]: vectorTileLayer(VectorId.TOPO, {
...OPTIONS,
id: MapBaseLayer.TOPO,
}),
};
return baseLayers;
......@@ -88,7 +89,7 @@ export function baseLayers(): Record<MapBaseLayer, L.TileLayer> {
/**
* Returns a specific Esri raster base layer.
*/
export function baseLayer(baseLayer: MapBaseLayer): L.TileLayer {
export function baseLayer(baseLayer: MapBaseLayer): L.LayerGroup {
return baseLayers()[baseLayer];
}
......@@ -156,8 +157,13 @@ const ARCGIS_URL_START =
const ARCGIS_URL_END = '/MapServer/tile/{z}/{y}/{x}';
const OPTIONS: L.MapOptions = {
maxZoom: 16,
attributionControl: false,
};
function arcUrl(id: string): string {
return `${ARCGIS_URL_START}${id}${ARCGIS_URL_END}`;
}
function transformCoordinate(
coordinates: number[],
transform: LocationTransform
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment