Add city map
This commit is contained in:
parent
da09b12a44
commit
5b69948846
@ -1,20 +1,23 @@
|
||||
/*import React, { useEffect } from 'react';
|
||||
import mapboxgl from 'mapbox-gl';
|
||||
import React, { useEffect } from "react";
|
||||
import mapboxgl from "mapbox-gl";
|
||||
|
||||
// Set your Mapbox access token
|
||||
mapboxgl.accessToken = 'pk.eyJ1IjoiYWxpLWFkbGkiLCJhIjoiY2xuM2JtYjV1MGE5djJrb2d5OGp1ZWNyNiJ9.gENyP4xX6ElLAeZFlE0aDg';
|
||||
mapboxgl.accessToken =
|
||||
"pk.eyJ1IjoiYWxpLWFkbGkiLCJhIjoiY2xuM2JtYjV1MGE5djJrb2d5OGp1ZWNyNiJ9.gENyP4xX6ElLAeZFlE0aDg";
|
||||
|
||||
/*
|
||||
Component to display a Mapbox map.
|
||||
*/
|
||||
/*
|
||||
|
||||
export function CityMap() {
|
||||
const remote_css = fetch("https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css");
|
||||
const remote_css = fetch(
|
||||
"https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css"
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const map = new mapboxgl.Map({
|
||||
container: 'map', // container ID
|
||||
style: 'mapbox://styles/mapbox/streets-v12', // style URL
|
||||
container: "map", // container ID
|
||||
style: "mapbox://styles/mapbox/streets-v12", // style URL
|
||||
center: [-73.5801403, 45.4962261], // starting position [lng, lat]
|
||||
zoom: 15, // starting zoom
|
||||
});
|
||||
@ -25,11 +28,7 @@ export function CityMap() {
|
||||
return () => map.remove();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div id="map"></div>
|
||||
);
|
||||
return <div id="map"></div>;
|
||||
}
|
||||
|
||||
export default CityMap;
|
||||
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user