-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pablo Lopez
committed
Aug 28, 2024
1 parent
8a71f87
commit 36afed1
Showing
4 changed files
with
58 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/interface/src/app/treatments/treatment-map/map-base-layers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { MapOptions } from 'maplibre-gl'; | ||
import { environment } from '../../../environments/environment'; | ||
|
||
type StadiaBaseMap = 'road'; | ||
type ArcgisRest = 'terrain' | 'satellite'; | ||
|
||
export const DEFAULT_BASE_MAP: StadiaBaseMap = 'road'; | ||
export type BaseLayerType = StadiaBaseMap | ArcgisRest; | ||
|
||
export const baseLayerStyles: Record<BaseLayerType, MapOptions['style']> = { | ||
road: | ||
'https://tiles.stadiamaps.com/styles/alidade_smooth.json?api_key=' + | ||
environment.stadiamaps_key, | ||
|
||
terrain: rasterSource( | ||
'worldTerrain', | ||
'https://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}' | ||
), | ||
satellite: rasterSource( | ||
'restSatellite', | ||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' | ||
), | ||
}; | ||
|
||
function rasterSource(sourceName: string, url: string): MapOptions['style'] { | ||
return { | ||
version: 8, | ||
metadata: { | ||
'mapbox:autocomposite': true, | ||
}, | ||
glyphs: 'https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf', | ||
sources: { | ||
[sourceName]: { | ||
type: 'raster', | ||
tiles: [url], | ||
tileSize: 256, | ||
}, | ||
}, | ||
layers: [ | ||
{ | ||
id: sourceName + '-layer', | ||
type: 'raster', | ||
source: sourceName, | ||
}, | ||
], | ||
}; | ||
} |
52 changes: 5 additions & 47 deletions
52
src/interface/src/app/treatments/treatment-map/map-config.state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters