Skip to content

Commit

Permalink
new map providers for water sports
Browse files Browse the repository at this point in the history
  • Loading branch information
limex committed Apr 3, 2024
1 parent afe9793 commit f5a5214
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dist/background.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/background.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"OpenSwitchMaps_limex","version":"1.5.1","description":"Switch map services and Tools for OpenStreetMap contributors","homepage_url":"https://github.com/limex/OpenSwitchMaps","permissions":["activeTab","tabs","storage"],"background":{"scripts":["background.js"]},"page_action":{"default_popup":"popup.html","default_icon":{"128":"icon128.png"}},"icons":{"128":"icon128.png"},"options_ui":{"page":"options.html"},"manifest_version":2}
{"name":"OpenSwitchMaps_limex","version":"1.6.0","description":"Switch map services and Tools for OpenStreetMap contributors","homepage_url":"https://github.com/limex/OpenSwitchMaps","permissions":["activeTab","tabs","storage"],"background":{"scripts":["background.js"]},"page_action":{"default_popup":"popup.html","default_icon":{"128":"icon128.png"}},"icons":{"128":"icon128.png"},"options_ui":{"page":"options.html"},"manifest_version":2}
1 change: 0 additions & 1 deletion dist/options.7e06c82b.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions dist/options.7e06c82b.js → dist/options.c112da62.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/options.c112da62.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/options.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="stylesheet" href="/options.21194506.css"></head><body> <div id="options"></div> <script src="/options.7e06c82b.js"></script> </body></html>
<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="stylesheet" href="/options.21194506.css"></head><body> <div id="options"></div> <script src="/options.c112da62.js"></script> </body></html>
4 changes: 2 additions & 2 deletions dist/popup.fb203266.js → dist/popup.756723e4.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/popup.756723e4.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/popup.fb203266.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/popup.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="stylesheet" href="/popup.d0afbe9b.css"></head><body> <div id="popup"></div> <script src="/popup.fb203266.js"></script> </body></html>
<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="stylesheet" href="/popup.d0afbe9b.css"></head><body> <div id="popup"></div> <script src="/popup.756723e4.js"></script> </body></html>
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openswitchmapslimex",
"version": "1.5.1",
"version": "1.6.0",
"description": "Switch map services and Tools for OpenStreetMap contributors",
"scripts": {
"dev": "parcel watch src/manifest.json",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "OpenSwitchMaps_limex",
"version": "1.5.1",
"version": "1.6.0",
"description": "Switch map services and Tools for OpenStreetMap contributors",
"homepage_url": "https://github.com/limex/OpenSwitchMaps",
"permissions": [
Expand Down
120 changes: 119 additions & 1 deletion src/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ function getLatLonZoom(url) {
}
}

function getZoomLevel(radius) {
let zoomLevel;
if (radius > 0) {
let radiusElevated = radius + radius / 2;
let scale = radiusElevated / 500;
zoomLevel = 18 - Math.log(scale) / Math.log(2);
}
zoomLevel = parseFloat(zoomLevel.toFixed(2));
return zoomLevel;
}

function getRadiusForZoomLevel(zoomLevel) {
let scale = Math.pow(2, 18 - zoomLevel);
let radiusElevated = scale * 500;
let radius = radiusElevated - radiusElevated / 2;
return radius;
}

//------------ replace below here -------------

function bboxToLatLonZoom(minlon, minlat, maxlon, maxlat) {
Expand Down Expand Up @@ -189,7 +207,7 @@ const maps_raw = [
description: "Wikidata items",
getUrl(lat, lon, zoom) {
return (
"https://map.osm.wikidata.link/map/" +
"https://map.osm.wikidata.link/map/" +
zoom +
"/" +
lat +
Expand Down Expand Up @@ -238,6 +256,58 @@ const maps_raw = [
}
},
},
{
// https://www.flosm.org/de/Wassersport.html?lat=4.88779867&lon=7.08481579&r=238418.58&st=0&sw=anchorage,beacon,boathoist,boatyard,canoe,canoeing,crane,dock,ferryroute,ferrystop,ferryterminal,harbour,harbourmaster,marina,marinaberth,mooring,mooringbuoy,mooringitem,mooringprivate,pier,portfacilityberth,portfacilityoffice,rowing,seamarkbeacon,seamarkbuoy,seamarknotice,separationzone,shipwreck,slipway,watermotorboat,waternoboat,waterpoint,waterrowboat,watership,waterwayfuel,waterwayguide,waterwaylockgate,waterwayweir

name: "flosm",
category: WATER_CATEGORY,
default_check: true,
domain: "flosm.org",
description: "Watersport",
getUrl(lat, lon, zoom) {
return (
"https://www.flosm.org/de/Wassersport.html?lat=" +
lat +
"&lon=" +
lon +
"&r=" +
getRadiusForZoomLevel(zoom) +
"&st=0&sw=anchorage,beacon,boathoist,boatyard,canoe,canoeing,crane,dock,ferryroute,ferrystop,ferryterminal,harbour,harbourmaster,marina,marinaberth,mooring,mooringbuoy,mooringitem,mooringprivate,pier,portfacilityberth,portfacilityoffice,rowing,seamarkbeacon,seamarkbuoy,seamarknotice,separationzone,shipwreck,slipway,watermotorboat,waternoboat,waterpoint,waterrowboat,watership,waterwayfuel,waterwayguide,waterwaylockgate,waterwayweir"
);
},
getLatLonZoom(url) {
const match = url.match(
/flosm\.org\/de\/Wassersport\.html\?lat=(-?\d[0-9.]*)&lon=(-?\d[0-9.]*)&r=(-?\d[0-9.]*)/
);
if (match) {
let [, lat, lon, radius] = match;
zoom = getZoomLevel(radius);
zoom = Math.round(zoom);
return [lat, lon, zoom];
}
},
},
{
// https://maps.grade.de/cemt.html#10/47.487550/16.964598
name: "Grade.de",
category: WATER_CATEGORY,
default_check: true,
domain: "grade.de",
description: "by lenght, navigatable",
getUrl(lat, lon, zoom) {
return "https://maps.grade.de/cemt.html#" + zoom + "/" + lat + "/" + lon;
},
getLatLonZoom(url) {
const match = url.match(
/maps\.grade\.de\/cemt\.html#(\d[0-9.]*)\/(-?\d[0-9.]*)\/(-?\d[0-9.]*)/
);
if (match) {
let [, zoom, lat, lon] = match;
zoom = Math.round(zoom);
return [lat, lon, zoom];
}
},
},
{
name: "OpenStreetCam",
category: POI_CATEGORY,
Expand Down Expand Up @@ -519,6 +589,54 @@ const maps_raw = [
}
},
},
{
name: "BRouter Grade.de",
category: WATER_CATEGORY,
default_check: true,
domain: "grade.de",
description: "Waterway Routing",
getUrl(lat, lon, zoom) {
return (
"https://brouter.grade.de/#map=" +
zoom +
"/" +
lat +
"/" +
lon +
"/CARTO,Seamarks,Wasserstrassenklassen,Bevaarbaarheid,Vaarweginformatie,route-quality&profile=river_canoe"
);
},
getLatLonZoom(url) {
const match = url.match(
/brouter\.grade\.de\/.*#map=(\d{1,2})\/(-?\d[0-9.]*)\/(-?\d[0-9.]*)/
);
if (match) {
const [, zoom, lat, lon] = match;
return [lat, lon, zoom];
}
},
},
{
name: "Flussinfo",
category: WATER_CATEGORY,
default_check: true,
domain: "flussinfo.net",
description: "North Germany only",
getUrl(lat, lon, zoom) {
return (
"https://www.flussinfo.net/map/#" + zoom + "/" + lat + "/" + lon + ""
);
},
getLatLonZoom(url) {
const match = url.match(
/flussinfo\.net\/map\/#(\d{1,2})\/(-?\d[0-9.]*)\/(-?\d[0-9.]*)/
);
if (match) {
const [, zoom, lat, lon] = match;
return [lat, lon, zoom];
}
},
},
{
name: "Bikerouter",
category: CYCLING_CATEGORY,
Expand Down

0 comments on commit f5a5214

Please sign in to comment.