diff --git a/application/assets/js/module.js b/application/assets/js/module.js
index 19ae0400..0878716d 100644
--- a/application/assets/js/module.js
+++ b/application/assets/js/module.js
@@ -424,7 +424,14 @@ const module = (() => {
//show selected marker
map.setView(markers_collection[index].getLatLng());
- console.log(markers_collection[index]);
+
+ let marker_latlng = markers_collection[index].getLatLng();
+
+ what3words(marker_latlng.lat, marker_latlng.lng, "76YHEAE5").then(
+ (what3wordsAddress) => {
+ document.querySelector("#what3words").textContent = what3wordsAddress;
+ }
+ );
//popup
document.querySelector("input#popup").value = "";
@@ -1237,6 +1244,24 @@ const module = (() => {
return a.toFixed(2);
};
+ let what3words = (lat, lng, key) => {
+ const url = `https://api.what3words.com/v3/convert-to-3wa?coordinates=${lat},${lng}&key=${key}`;
+
+ return fetch(url)
+ .then((response) => response.json())
+ .then((data) => {
+ if (data.words) {
+ return data.words;
+ } else {
+ throw new Error(data);
+ }
+ })
+ .catch((error) => {
+ console.error("Error:", error);
+ return "sorry, could not be determined";
+ });
+ };
+
return {
hotline,
convert_units,
@@ -1262,5 +1287,6 @@ const module = (() => {
uniqueId,
parseGPX,
update_gpx_info,
+ what3words,
};
})();
diff --git a/application/index.html b/application/index.html
index 720c264b..44e2f678 100644
--- a/application/index.html
+++ b/application/index.html
@@ -121,6 +121,13 @@
remove marker
+
What3words
+
+
+
+
+
+
Routing
set as start point
diff --git a/application/manifest.webapp b/application/manifest.webapp
index 9df520eb..2166ab40 100644
--- a/application/manifest.webapp
+++ b/application/manifest.webapp
@@ -1,5 +1,5 @@
{
- "version": "1.9.791",
+ "version": "1.9.792",
"version_name": "hotline",
"name": "o.map",
"description": "O.map, your ultimate navigation companion for KaiOS-powered devices. O.map is a lightweight and feature-rich map application designed specifically for KaiOS, enabling you to explore and navigate the world with ease. Whether you're a local resident, a tourist, or an adventurer, O.map is here to enhance your journey and keep you on the right track.",
diff --git a/application/manifest.webmanifest b/application/manifest.webmanifest
index d47957d1..d39709df 100644
--- a/application/manifest.webmanifest
+++ b/application/manifest.webmanifest
@@ -21,7 +21,7 @@
],
"b2g_features": {
- "version": "2.0.95",
+ "version": "2.0.96",
"id": "o.map",
"core": true,
"categories": ["utilities"],
diff --git a/docs/assets/js/module.js b/docs/assets/js/module.js
index 19ae0400..0878716d 100644
--- a/docs/assets/js/module.js
+++ b/docs/assets/js/module.js
@@ -424,7 +424,14 @@ const module = (() => {
//show selected marker
map.setView(markers_collection[index].getLatLng());
- console.log(markers_collection[index]);
+
+ let marker_latlng = markers_collection[index].getLatLng();
+
+ what3words(marker_latlng.lat, marker_latlng.lng, "76YHEAE5").then(
+ (what3wordsAddress) => {
+ document.querySelector("#what3words").textContent = what3wordsAddress;
+ }
+ );
//popup
document.querySelector("input#popup").value = "";
@@ -1237,6 +1244,24 @@ const module = (() => {
return a.toFixed(2);
};
+ let what3words = (lat, lng, key) => {
+ const url = `https://api.what3words.com/v3/convert-to-3wa?coordinates=${lat},${lng}&key=${key}`;
+
+ return fetch(url)
+ .then((response) => response.json())
+ .then((data) => {
+ if (data.words) {
+ return data.words;
+ } else {
+ throw new Error(data);
+ }
+ })
+ .catch((error) => {
+ console.error("Error:", error);
+ return "sorry, could not be determined";
+ });
+ };
+
return {
hotline,
convert_units,
@@ -1262,5 +1287,6 @@ const module = (() => {
uniqueId,
parseGPX,
update_gpx_info,
+ what3words,
};
})();
diff --git a/docs/assets/js/openweather.js b/docs/assets/js/openweather.js
index 9bbc9248..90c2093a 100644
--- a/docs/assets/js/openweather.js
+++ b/docs/assets/js/openweather.js
@@ -1,4 +1,5 @@
const weather = (() => {
+ //todo > 2024 06 change to 3.O
let openweather_call = function (lat, lng, apikey, callback) {
let xhr = new XMLHttpRequest({
mozSystem: true,
diff --git a/docs/assets/js/settings.js b/docs/assets/js/settings.js
index f02e18a0..969b178c 100644
--- a/docs/assets/js/settings.js
+++ b/docs/assets/js/settings.js
@@ -1,10 +1,6 @@
const settings = ((_) => {
let save_settings = function () {
localStorage.setItem("owm-key", document.getElementById("owm-key").value);
- localStorage.setItem(
- "ipbase-key",
- document.getElementById("ipbase-key").value
- );
localStorage.setItem(
"routing_profil",
@@ -78,9 +74,7 @@ const settings = ((_) => {
localStorage["tracking-notification-time"] || 0,
openweather_api: localStorage.getItem("owm-key"),
- ipbase_api: localStorage.getItem("ipbase-key")
- ? localStorage.getItem("ipbase-key")
- : "",
+
ors_api: localStorage.getItem("ors-key"),
routing_profil: localStorage.getItem("routing_profil")
? localStorage.getItem("routing_profil")
@@ -176,7 +170,6 @@ const settings = ((_) => {
//set values in setting page
document.getElementById("owm-key").value = setting.openweather_api;
- document.getElementById("ipbase-key").value = setting.ipbase_api;
document.getElementById("ors-key").value = setting.ors_api;
document.getElementById("routing-profil").value = setting.routing_profil;
@@ -244,7 +237,6 @@ const settings = ((_) => {
setTimeout(() => {
document.getElementById("owm-key").value = setting.openweather_api;
- document.getElementById("ipbase-key").value = setting.ipbase_api;
document.getElementById("ors-key").value = setting.ors_api;
document.getElementById("routing-profil").value =
setting.routing_profil;
@@ -293,8 +285,7 @@ const settings = ((_) => {
setTimeout(() => {
document.getElementById("owm-key").value =
setting.openweather_api;
- document.getElementById("ipbase-key").value =
- setting.ipbase_api;
+
document.getElementById("ors-key").value =
setting.ors_api;
document.getElementById("routing-profil").value =
diff --git a/docs/index.html b/docs/index.html
index 5123e49a..44e2f678 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -121,6 +121,13 @@
remove marker
+ What3words
+
+
+
+
+
+
Routing
set as start point
@@ -240,12 +247,6 @@
Routing Service
- IP Geolocation
-
-
-
-
-
Crosshair