davvalent commited on 2022-10-19 20:48:58
Showing 2 changed files, with 18 additions and 19 deletions.
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/** |
| 2 |
- * Le Faubourg à m’lasse en ligne (FML) |
|
| 2 |
+ * Plan interactif du Faubourg à m’lasse (PIFM) |
|
| 3 | 3 |
* |
| 4 | 4 |
* Plan interactif du Faubourg à m’lasse (secteur Radio-Canada) intégrant des données |
| 5 | 5 |
* structurées, des photograpies d’archives, des cartes historiques et d’autres données. |
| ... | ... |
@@ -8,17 +8,6 @@ |
| 8 | 8 |
* @author David Valentine <d@ntnlv.ca> |
| 9 | 9 |
*/ |
| 10 | 10 |
|
| 11 |
-/** |
|
| 12 |
- * Mapbox config |
|
| 13 |
- * @todo encode access token |
|
| 14 |
- */ |
|
| 15 |
-const mapBoxURL = "https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}",
|
|
| 16 |
-mapBoxConfig = {
|
|
| 17 |
- attribution: "Map data © <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, Imagery © <a href=\"https://www.mapbox.com/\">Mapbox</a>, Archives de Montréal", |
|
| 18 |
- id: "mapbox/streets-v11", |
|
| 19 |
- accessToken: "pk.eyJ1IjoiZGF2dmFsZW50IiwiYSI6ImNrdmluZjh6cTBnYjkydXFna3lnOWRwM3oifQ.7qwZCUJ2JW2WFJ8JtDQfUg" |
|
| 20 |
-}; |
|
| 21 |
- |
|
| 22 | 11 |
(async () => {
|
| 23 | 12 |
|
| 24 | 13 |
/** |
| ... | ... |
@@ -27,18 +16,28 @@ mapBoxConfig = {
|
| 27 | 16 |
* @todo voir https://geojson.org/geojson-ld/ |
| 28 | 17 |
* @todo voir linked places format |
| 29 | 18 |
*/ |
| 30 |
- const response = await fetch("./buildings.json"),
|
|
| 31 |
- geojsonFeatures = await response.json(), |
|
| 19 |
+ let response = await fetch("./buildings.json");
|
|
| 20 |
+ const geojsonFeatures = await response.json(); |
|
| 21 |
+ |
|
| 22 |
+ /** FAML Tiles */ |
|
| 23 |
+ let tilesUrl = "https://ntnlv.ca/faubourg/tiles/{z}/{x}/{y}.png";
|
|
| 24 |
+ |
|
| 25 |
+ /** Localhost tiles for dev */ |
|
| 26 |
+ if (location.host === "localhost" || location.host === "127.0.0.1") {
|
|
| 27 |
+ response = await fetch("./js/config.json");
|
|
| 28 |
+ tilesUrl = await response.json(); |
|
| 29 |
+ tilesUrl = tilesUrl.devUrl; |
|
| 30 |
+ } |
|
| 32 | 31 |
|
| 33 | 32 |
/** Base Layer */ |
| 34 |
- baseLayer = L.tileLayer("https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}", {
|
|
| 35 |
- attribution: "Map data © <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, Imagery © Google, Archives de Montréal", |
|
| 33 |
+ const baseLayer = L.tileLayer("https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}", {
|
|
| 34 |
+ attribution: "Map data © QDMTL, Imagery © Google, Archives de Montréal", |
|
| 36 | 35 |
maxZoom: 20, |
| 37 | 36 |
tileSize: 256 |
| 38 | 37 |
}), |
| 39 | 38 |
|
| 40 |
- /** Faubourg Layer */ |
|
| 41 |
- faubourgLayer = L.tileLayer("https://ntnlv.ca/faubourg/tiles/{z}/{x}/{y}.png", {
|
|
| 39 |
+ /** FAML Layer */ |
|
| 40 |
+ faubourgLayer = L.tileLayer(tilesUrl, {
|
|
| 42 | 41 |
maxZoom: 20, |
| 43 | 42 |
tileSize: 256, |
| 44 | 43 |
opacity: 1 |
| ... | ... |
@@ -98,4 +97,3 @@ mapBoxConfig = {
|
| 98 | 97 |
geoJSON.addTo(planDuFaubourg); |
| 99 | 98 |
|
| 100 | 99 |
})(); |
| 101 | 100 |
\ No newline at end of file |
| 102 |
- |
|
| 103 | 101 |