generated from taylorbryant/gatsby-starter-tailwind
-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(wip): migrate to our self-hosted map tiles
- Loading branch information
viet nguyen
committed
Feb 26, 2024
1 parent
0f22935
commit 70b7e39
Showing
6 changed files
with
206 additions
and
13 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
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
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,44 @@ | ||
import { Source, Layer } from 'react-map-gl' | ||
|
||
/** | ||
* OpenBeta custom map tiles | ||
* @returns | ||
*/ | ||
export const OBCustomLayers: React.FC = () => { | ||
return ( | ||
<Source | ||
id='crags-source' // can be any unique id | ||
type='vector' | ||
tiles={[ | ||
'https://maptiles.openbeta.io/crags/{z}/{x}/{y}.pbf' | ||
]} | ||
attribution='© OpenBeta contributors' | ||
> | ||
<Layer | ||
/** | ||
* Can be any unique id. In order for the mouse to interact with the layer, | ||
* the id must be specified in ReactMapGL's interactiveLayerIds prop | ||
*/ | ||
id='crags' | ||
type='symbol' | ||
source-layer='crags' // source-layer is the layer name in the vector tileset | ||
layout={{ | ||
'text-field': ['get', 'name'], | ||
'text-size': 12, | ||
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'], | ||
'icon-image': 'circle', | ||
'icon-size': ['interpolate', ['linear'], ['zoom'], 8, 0.25, 16, 1], | ||
'text-variable-anchor': ['bottom', 'left', 'right'], | ||
'text-radial-offset': 0.5 | ||
}} | ||
paint={{ | ||
'icon-color': '#111827', | ||
'text-halo-blur': 1, | ||
'text-halo-width': 1, | ||
'text-color': '#111827', | ||
'text-halo-color': '#f8fafc' | ||
}} | ||
/> | ||
</Source> | ||
) | ||
} |
Oops, something went wrong.