Created
August 13, 2020 16:15
-
-
Save andion/d5eabe3505211d469802f92d1dd3eb4a to your computer and use it in GitHub Desktop.
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
import React from "react"; | |
import { Map as LeafletMap, Marker, Popup, TileLayer } from "react-leaflet"; | |
// GET ONE in https://docs.mapbox.com/help/how-mapbox-works/access-tokens/"; | |
const ACCESS_TOKEN = "--YOUR--ACCESS--TOKEN--"; | |
const URL = `https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=${ACCESS_TOKEN}`; | |
const ATTRIBUTION = | |
'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>'; | |
const TOWER_LOCATION = [43.385807, -8.406524]; | |
const MyMap = () => ( | |
<LeafletMap center={TOWER_LOCATION} zoom={16}> | |
<TileLayer url={URL} attribution={ATTRIBUTION} /> | |
<Marker position={TOWER_LOCATION}> | |
<Popup> | |
<b>Tower of Hercules</b> | |
<br /> | |
UNESCO World Heritage site | |
</Popup> | |
</Marker> | |
</LeafletMap> | |
); | |
export default MyMap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment