Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-utils-ts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-utils-ts
Commits
c5c3627d
Commit
c5c3627d
authored
1 month ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
add new vecotr tile layers
parent
fa69a407
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!245
Vector maps
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/leaflet/map-baselayer.model.ts
+5
-36
5 additions, 36 deletions
libs/leaflet/map-baselayer.model.ts
libs/leaflet/map.utils.ts
+67
-61
67 additions, 61 deletions
libs/leaflet/map.utils.ts
with
72 additions
and
97 deletions
libs/leaflet/map-baselayer.model.ts
+
5
−
36
View file @
c5c3627d
/**
* 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
'
,
}
This diff is collapsed.
Click to expand it.
libs/leaflet/map.utils.ts
+
67
−
61
View file @
c5c3627d
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
.
Tile
Layer
{
export
function
baseLayer
(
baseLayer
:
MapBaseLayer
):
L
.
Layer
Group
{
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment