Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions app/assets/javascripts/embed.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ window.onload = function () {
map.attributionControl.setPrefix('');
map.removeControl(map.attributionControl);

if (!args.layer || args.layer === "mapnik" || args.layer === "osmarender" || args.layer === "mapquest") {
new L.OSM.Mapnik().addTo(map);
} else if (args.layer === "historical") {
new L.OSM.Historical().addTo(map);
} else if (args.layer === "cyclemap" || args.layer === "cycle map") {
new L.OSM.CycleMap(thunderforestOptions).addTo(map);
} else if (args.layer === "transportmap") {
new L.OSM.TransportMap(thunderforestOptions).addTo(map);
} else if (args.layer === "hot") {
new L.OSM.HOT().addTo(map);
} else {
new L.OSM.Mapnik(mapnikOptions).addTo(map);
}

if (args.marker) {
L.marker(args.marker.split(','), {icon: L.icon({
iconUrl: <%= asset_path('leaflet/dist/images/marker-icon.png').to_json %>,
Expand Down
103 changes: 68 additions & 35 deletions app/assets/javascripts/leaflet.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ L.OSM.Map = L.Map.extend({
}).prop("outerHTML");
var cyclosm = I18n.t("javascripts.map.cyclosm_credit", { cyclosm_link: cyclosm_link, osm_france_link: osm_france_link });

var thunderforest_link = $("<a>", {
href: "https://www.thunderforest.com/",
target: "_blank",
text: I18n.t("javascripts.map.andy_allan")
}).prop("outerHTML");
var thunderforest = I18n.t("javascripts.map.thunderforest_credit", { thunderforest_link: thunderforest_link });

var memomaps_link = $("<a>", {
href: "https://memomaps.de/",
target: "_blank",
Expand Down Expand Up @@ -144,48 +137,88 @@ L.OSM.Map = L.Map.extend({
name: I18n.t("javascripts.map.base.standard")
}));

this.baseLayers.push(new L.OSM.CyclOSM({
this.baseLayers.push(new L.MaplibreGL({
attribution: copyright + ". " + cyclosm + ". " + terms,
code: "Y",
keyid: "cyclosm",
name: I18n.t("javascripts.map.base.cyclosm")
keyid: "cyclosm",
name: I18n.t("javascripts.map.base.cyclosm"),
style: {
version: 8,
sources: {
'cyclosm': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This part of the diff is somewhat inconsistent in its use of single versus double quotation marks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is like this because the file I pulled it in from was using single quotes. Should I just change them to be consistent through?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, might as well to be internally consistent.

type: 'raster',
tiles: [
'https://a.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
'https://b.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
'https://c.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png'
],
tileSize: 256,
attribution: `${copyright}. ${cyclosm}. ${terms}`,
maxzoom: 20
}
},
layers: [{
id: 'cyclosm',
type: 'raster',
source: 'cyclosm'
}]
}
}));

if (OSM.THUNDERFOREST_KEY) {
this.baseLayers.push(new L.OSM.CycleMap({
attribution: copyright + ". " + thunderforest + ". " + terms,
apikey: OSM.THUNDERFOREST_KEY,
code: "C",
keyid: "cyclemap",
name: I18n.t("javascripts.map.base.cycle_map")
}));

this.baseLayers.push(new L.OSM.TransportMap({
attribution: copyright + ". " + thunderforest + ". " + terms,
apikey: OSM.THUNDERFOREST_KEY,
code: "T",
keyid: "transportmap",
name: I18n.t("javascripts.map.base.transport_map")
}));
}

this.baseLayers.push(new L.OSM.HOT({
this.baseLayers.push(new L.MaplibreGL({
attribution: copyright + ". " + hotosm + ". " + terms,
code: "H",
code: "H",
keyid: "hot",
name: I18n.t("javascripts.map.base.hot")
name: I18n.t("javascripts.map.base.hot"),
style: {
version: 8,
sources: {
'hot': {
type: 'raster',
tiles: [
'https://tile-a.openstreetmap.fr/hot/{z}/{x}/{y}.png',
'https://tile-b.openstreetmap.fr/hot/{z}/{x}/{y}.png',
'https://tile-c.openstreetmap.fr/hot/{z}/{x}/{y}.png'
],
tileSize: 256,
maxzoom: 20
}
},
layers: [{
id: 'hot',
type: 'raster',
source: 'hot'
}]
}
}));

this.noteLayer = new L.FeatureGroup();
this.noteLayer.options = { code: "N" };

this.dataLayer = new L.OSM.DataLayer(null);
this.dataLayer.options.code = "D";

this.gpsLayer = new L.OSM.GPS({
pane: "overlayPane",
this.gpsLayer = new L.MaplibreGL({
code: "G",
name: I18n.t("javascripts.map.base.gps")
name: I18n.t("javascripts.map.base.gps"),
style: {
version: 8,
sources: {
'gps': {
type: 'raster',
tiles: [
'https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png'
],
tileSize: 256,
maxZoom: 21,
maxNativeZoom: 20
}
},
layers: [{
id: 'gps',
type: 'raster',
source: 'gps'
}]
}
});

this.on("layeradd", function (event) {
Expand Down
12 changes: 4 additions & 8 deletions app/assets/javascripts/leaflet.share.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ L.OSM.share = function (options) {
}

function update() {
var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo";
var bounds = map.getBounds();

$("#link_marker")
Expand All @@ -364,13 +363,10 @@ L.OSM.share = function (options) {
}

$("#embed_link")
.toggleClass("btn-primary", canEmbed)
.toggleClass("btn-secondary", !canEmbed)
.tooltip(canEmbed ? "disable" : "enable");
if (!canEmbed && $("#embed_link").hasClass("active")) {
$("#long_link").click();
}

.toggleClass("btn-primary", true)
.toggleClass("btn-secondary", false)
.tooltip("disable");

const
parsedHash = new URLSearchParams(location.hash),
embeddedMapPath = parsedHash.get('#map'),
Expand Down
4 changes: 0 additions & 4 deletions app/assets/javascripts/osm.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ OSM = {
THUNDERFOREST_KEY: <%= Settings.thunderforest_key.to_json %>,
<% end %>

<% if Settings.key?(:tracestrack_key) %>
TRACESTRACK_KEY: <%= Settings.tracestrack_key.to_json %>,
<% end %>

LAYERS_WITH_MAP_KEY: <%= YAML.load_file(Rails.root.join("config/key.yml")).keys.to_json %>,

MARKER_GREEN: <%= image_path("marker-green.png").to_json %>,
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Rails.application.configure do
connect_src = [:self, "*.openhistoricalmap.org", "openhistoricalmap.github.io", "*.amazonaws.com"]
img_src = [:self, :data, "www.gravatar.com", "*.wp.com", "tile.openstreetmap.org", "gps.tile.openstreetmap.org", "*.tile.thunderforest.com", "tile.tracestrack.com", "*.openstreetmap.fr"]
img_src = [:self, :data, "www.gravatar.com", "*.wp.com", "tile.openstreetmap.org", "gps.tile.openstreetmap.org", "*.tile.thunderforest.com", "*.openstreetmap.fr"]
script_src = [:self, "openhistoricalmap.github.io"]
style_src = [:self, "openhistoricalmap.github.io"]
worker_src = [:self, :blob, "0.0.0.0:3000"]
Expand Down
2 changes: 0 additions & 2 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ fossgis_valhalla_url: "https://valhalla1.openstreetmap.de/route"

# Thunderforest authentication details
#thunderforest_key: ""
# Tracestrack authentication details
#tracestrack_key: ""
# Key for generating TOTP tokens
#totp_key: ""
# Enforce Content-Security-Policy
Expand Down
66 changes: 0 additions & 66 deletions vendor/assets/leaflet/leaflet.osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,72 +19,6 @@ L.OSM.Mapnik = L.OSM.TileLayer.extend({
}
});

L.OSM.CyclOSM = L.OSM.TileLayer.extend({
options: {
url: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
maxZoom: 20,
subdomains: 'abc',
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="https://www.openstreetmap.fr" target="_blank">OpenStreetMap France</a>'
}
});

L.OSM.Historical = L.OSM.TileLayer.extend({
options: {
url: 'http://www.openhistoricalmap.org/ohm_tiles/{z}/{x}/{y}.png',
maxZoom: 20
}
});

L.OSM.CycleMap = L.OSM.TileLayer.extend({
options: {
url: 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}{r}.png?apikey={apikey}',
maxZoom: 21,
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="http://www.thunderforest.com/" target="_blank">Andy Allan</a>'
}
});

L.OSM.TransportMap = L.OSM.TileLayer.extend({
options: {
url: 'https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}{r}.png?apikey={apikey}',
maxZoom: 21,
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="http://www.thunderforest.com/" target="_blank">Andy Allan</a>'
}
});

L.OSM.OPNVKarte = L.OSM.TileLayer.extend({
options: {
url: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
maxZoom: 18,
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="http://memomaps.de/" target="_blank">MeMoMaps</a>'
}
});

L.OSM.HOT = L.OSM.TileLayer.extend({
options: {
url: 'https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png',
maxZoom: 20,
subdomains: 'abc',
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
}
});

L.OSM.TracestrackTopo = L.OSM.TileLayer.extend({
options: {
url: 'https://tile.tracestrack.com/topo__/{z}/{x}/{y}.png?key={apikey}',
maxZoom: 19,
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="https://www.tracestrack.com/" target="_blank">Tracestrack Maps</a>'
}
});

L.OSM.GPS = L.OSM.TileLayer.extend({
options: {
url: 'https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png',
maxZoom: 21,
maxNativeZoom: 20,
subdomains: 'abc'
}
});

L.OSM.DataLayer = L.FeatureGroup.extend({
options: {
areaTags: ['area', 'building', 'leisure', 'tourism', 'ruins', 'historic', 'landuse', 'military', 'natural', 'sport'],
Expand Down