Skip to content

Commit

Permalink
use openstreetmap tiles as mapbox stopped working, also added analyti…
Browse files Browse the repository at this point in the history
…cs finally
  • Loading branch information
dereke committed Jan 22, 2021
1 parent 25ce9fd commit 2fdeb2b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 41 deletions.
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ set_meta_tags og: {
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', defer: true %>
<%= yield :page_head %>

<script async defer data-domain="carbonneutralmap.org.uk" src="https://plausible.io/js/plausible.js"></script>
</head>

<body>
Expand Down
16 changes: 6 additions & 10 deletions frontend/packs/animation_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ function initialiseMap({ initiatives, center }) {
zoomControl: false
});

L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",
{
maxZoom: 18,
attribution:
'<a href="https://www.mapbox.com/" target="_blank">&copy; Mapbox</a> ' +
'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>',
id: "mapbox.streets"
}
).addTo(animation_map);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
id: "mapbox.streets"
}).addTo(animation_map);

const markers = L.markerClusterGroup();
animation_map.addLayer(markers);
Expand Down
18 changes: 7 additions & 11 deletions frontend/packs/initiative_location_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@ class LocationPicker {
zoom: 13
});
this.locationMap = locationMap;
L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",
{
maxZoom: 18,
attribution:
'Map data &copy; <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>',
id: "mapbox.streets"
}
).addTo(locationMap);

L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
id: "mapbox.streets"
}).addTo(locationMap);

const center = locationMap.getCenter();
let marker = L.marker(center, { draggable: true, autoPan: true });
Expand Down
16 changes: 6 additions & 10 deletions frontend/packs/initiative_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ function initialiseMap({ initiatives, center }) {
})
.addTo(carbonExplorer);

L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",
{
maxZoom: 18,
attribution:
'<a href="https://www.mapbox.com/" target="_blank">&copy; Mapbox</a> ' +
'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>',
id: "mapbox.streets"
}
).addTo(carbonExplorer);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
id: "mapbox.streets"
}).addTo(carbonExplorer);

const markers = L.markerClusterGroup();
initiatives.forEach(initiative => {
Expand Down
16 changes: 6 additions & 10 deletions frontend/packs/initiatives_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ function initialiseMap({ initiatives, center }) {
})
.addTo(carbonExplorer);

L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",
{
maxZoom: 18,
attribution:
'<a href="https://www.mapbox.com/" target="_blank">&copy; Mapbox</a> ' +
'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>',
id: "mapbox.streets"
}
).addTo(carbonExplorer);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
id: "mapbox.streets"
}).addTo(carbonExplorer);

markers = L.markerClusterGroup();

Expand Down

0 comments on commit 2fdeb2b

Please sign in to comment.