@@ -6,7 +6,14 @@ import {
66 Spinner ,
77 Tag ,
88} from "@blueprintjs/core" ;
9- import { SETTINGS , apiV2Prefix } from "@macrostrat-web/settings" ;
9+ import {
10+ tileserverDomain ,
11+ apiV2Prefix ,
12+ darkMapURL ,
13+ baseMapURL ,
14+ satelliteMapURL ,
15+ mapboxAccessToken ,
16+ } from "@macrostrat-web/settings" ;
1017import {
1118 DetailPanelStyle ,
1219 InfoDrawerContainer ,
@@ -15,7 +22,7 @@ import {
1522 MapView ,
1623 PanelCard ,
1724} from "@macrostrat/map-interface" ;
18- import { buildMacrostratStyle } from "@macrostrat/mapbox-styles" ;
25+ import { buildMacrostratStyleLayers } from "@macrostrat/mapbox-styles" ;
1926import { getMapboxStyle , mergeStyles } from "@macrostrat/mapbox-utils" ;
2027import {
2128 JSONView ,
@@ -51,6 +58,30 @@ const emptyStyle: any = {
5158 layers : [ ] ,
5259} ;
5360
61+ function buildMacrostratStyle ( {
62+ fillOpacity = 0.4 ,
63+ strokeOpacity = 0.2 ,
64+ lineOpacity = 1 ,
65+ focusedMap = null ,
66+ } ) : mapboxgl . Style {
67+ const tileURL = `${ tileserverDomain } /map/{z}/{x}/{y}?source_id=${ focusedMap } ` ;
68+
69+ return {
70+ version : 8 ,
71+ sources : {
72+ burwell : {
73+ type : "vector" ,
74+ tiles : [ tileURL ] ,
75+ } ,
76+ } ,
77+ layers : buildMacrostratStyleLayers ( {
78+ fillOpacity,
79+ strokeOpacity,
80+ lineOpacity,
81+ } ) ,
82+ } ;
83+ }
84+
5485function buildOverlayStyle ( {
5586 style,
5687 focusedMap,
@@ -60,7 +91,6 @@ function buildOverlayStyle({
6091 let mapStyle = emptyStyle ;
6192 if ( layerOpacity . vector != null ) {
6293 mapStyle = buildMacrostratStyle ( {
63- tileserverDomain : SETTINGS . burwellTileDomain ,
6494 focusedMap,
6595 fillOpacity : layerOpacity . vector - 0.1 ,
6696 strokeOpacity : layerOpacity . vector + 0.2 ,
@@ -75,9 +105,7 @@ function buildOverlayStyle({
75105 raster : {
76106 type : "raster" ,
77107 tiles : [
78- SETTINGS . burwellTileDomain +
79- "/cog/tiles/{z}/{x}/{y}.png?url=" +
80- rasterURL ,
108+ tileserverDomain + "/cog/tiles/{z}/{x}/{y}.png?url=" + rasterURL ,
81109 ] ,
82110 tileSize : 256 ,
83111 } ,
@@ -124,9 +152,9 @@ enum Basemap {
124152function basemapStyle ( basemap , inDarkMode ) {
125153 switch ( basemap ) {
126154 case Basemap . Satellite :
127- return SETTINGS . satelliteMapURL ;
155+ return satelliteMapURL ;
128156 case Basemap . Basic :
129- return inDarkMode ? SETTINGS . darkMapURL : SETTINGS . baseMapURL ;
157+ return inDarkMode ? darkMapURL : baseMapURL ;
130158 case Basemap . None :
131159 return null ;
132160 }
@@ -152,7 +180,7 @@ export function Page() {
152180 if ( layer == null ) setStyle ( null ) ;
153181 const styleURL = basemapStyle ( layer , dark ) ;
154182 getMapboxStyle ( styleURL , {
155- access_token : SETTINGS . mapboxAccessToken ,
183+ access_token : mapboxAccessToken ,
156184 } ) . then ( setStyle ) ;
157185 } , [ layer , dark ] ) ;
158186
@@ -292,7 +320,7 @@ export function Page() {
292320 MapView ,
293321 {
294322 style : mapStyle , //"mapbox://styles/mapbox/satellite-v9",
295- mapboxToken : SETTINGS . mapboxAccessToken ,
323+ mapboxToken : mapboxAccessToken ,
296324 //projection: { name: "globe" },
297325 bounds,
298326 mapPosition : null ,
0 commit comments