Skip to content

Commit

Permalink
POI
Browse files Browse the repository at this point in the history
  • Loading branch information
strukturart committed Jun 23, 2024
1 parent 40b3668 commit d041981
Show file tree
Hide file tree
Showing 17 changed files with 493 additions and 130 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion application/assets/js/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ const maps = (() => {
let overlayer = "";

let addMap = function (url, attribution, max_zoom, type, marker) {
console.log(general.active_layer);
if (attribution == null) attribution = "";
if (max_zoom == null) max_zoom = 17;
//remove layer
Expand Down
8 changes: 8 additions & 0 deletions application/assets/js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,14 @@ const module = (() => {
helper.bottom_bar("cancel", "option", "");

//show selected marker
//show/hide popop editor input field
if (markers_collection[index].tag == undefined) {
document.querySelector("#popup-editor").style.display = "block";
} else {
document.querySelector("#popup-editor").style.display = "none";
}

//get latlng
map.setView(markers_collection[index].getLatLng());

let marker_latlng = markers_collection[index].getLatLng();
Expand Down
19 changes: 14 additions & 5 deletions application/assets/js/overpass.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,25 @@ const overpass = (() => {
return false;
}

//boundingbox
let e = map.getBounds().getEast();
let w = map.getBounds().getWest();
let n = map.getBounds().getNorth();
let s = map.getBounds().getSouth();
let currentBounds = map.getBounds();

// Apply 20% padding to the bounds
let paddedBounds = currentBounds.pad(0.2);

// Extract the padded bounds
let e = paddedBounds.getEast();
let w = paddedBounds.getWest();
let n = paddedBounds.getNorth();
let s = paddedBounds.getSouth();

// Create the bounding box string
var bounds = s + "," + w + "," + n + "," + e;

// Construct the queries using the padded bounds
var nodeQuery = "(node" + node_query + "(" + bounds + ");";
var wayQuery = "way" + way_query + "(" + bounds + ");";
var relationQuery = "relation" + relation_query + "(" + bounds + ");)";

var query =
"?data=[out:json][timeout:25];" +
nodeQuery +
Expand Down
14 changes: 9 additions & 5 deletions application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,28 @@
<h2>What3words</h2>
<div class="item" id="what3words" tabindex="3"></div>

<div class="item" data-action="share" tabindex="4">
share
</div>





<h2>Routing</h2>
<div class="item" data-action="set_marker_route_start" tabindex="3">
<div class="item" data-action="set_marker_route_start" tabindex="5">
set as start point
</div>

<div class="item" data-action="set_marker_route_end" tabindex="3">
<div class="item" data-action="set_marker_route_end" tabindex="6">
set as end point
</div>

<div class="item" data-action="auto_update_route" tabindex="4">
<div class="item" data-action="auto_update_route" tabindex="7">
get me there
</div>

<div class="item input-parent" tabindex="4">
<div class="item input-parent" id="popup-editor" tabindex="8">
<label for="popup">popup text</label>
<input type="text" id="popup" />
</div>
Expand Down Expand Up @@ -191,7 +195,7 @@ <h2>MAPS</h2>
<h2>LAYERS</h2>
<div id="layers"></div>

<h2>OVERPASS</h2>
<h2>POI</h2>
<div id="overpass"></div>
</div>

Expand Down
49 changes: 45 additions & 4 deletions application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ let status = {
screenOff: false,
follow_path: false,
select_gpx: false,
notKaiOS: false,
};

let tracking = {};
Expand Down Expand Up @@ -157,7 +158,7 @@ if ("b2g" in Navigator) {
//leaflet add basic map
map = new L.map("map-container", {
zoomControl: false,
dragging: false,
dragging: true,
keyboard: true,
});

Expand Down Expand Up @@ -370,14 +371,48 @@ document.addEventListener("DOMContentLoaded", function () {
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="water" data-map="water">Drinking water <i>Layer</i></div>'
'<div class="item" data-marker="public_transport" data-type="overpass" data-url="public_transport=stop_position" data-map="public_transport">Public transport</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-marker="public_transport" data-type="overpass" data-url="public_transport=stop_position" data-map="public_transport">public transport <i>Layer</i></div>'
'<div class="item" data-type="overpass" data-url="amenity=hospital">Hospital</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="water">Drinking water</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="tourism=camp_site">Camping</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="tourism=hotel">Hotel</div>'
);
document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="amenity=restaurant">Restaurant</div>'
);

document
.querySelector("div#overpass")
.insertAdjacentHTML(
"afterend",
'<div class="item" data-type="overpass" data-url="amenity=bar">Bar</div>'
);

find_gpx();
Expand Down Expand Up @@ -1241,6 +1276,13 @@ document.addEventListener("DOMContentLoaded", function () {
) {
let item_value = document.activeElement.getAttribute("data-action");

if (item_value == "share") {
mozactivity.share_position();
document.querySelector("div#markers-option").style.display = "none";
helper.bottom_bar("", "", "");
status.windowOpen = "map";
}

if (item_value == "auto_update_route") {
routing.active = true;
routing.auto_routing = true;
Expand Down Expand Up @@ -1939,7 +1981,6 @@ document.addEventListener("DOMContentLoaded", function () {

let b = document.activeElement.closest("div.menu-box");
let items_list = b.querySelectorAll(".item");
console.log(items_list.length);

if (move == "+1") {
if (tabIndex < items_list.length - 1) {
Expand Down
2 changes: 1 addition & 1 deletion application/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.9.792",
"version": "1.9.794",
"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.",
Expand Down
30 changes: 29 additions & 1 deletion application/manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"lang": "en-US",
"start_url": "/index.html",
"priority": "high",
"display": "standalone",
"userAgentInfo": "o.map written by strukturart@gmail.com",

"icons": [
Expand All @@ -18,10 +19,37 @@
"type": "image/png",
"sizes": "112x112"
}
{
"src": "assets/icons/favicon.ico",
"type": "image/x-icon",
"sizes": "16x16 32x32"
},
{
"src": "assets/icons/icon-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "assets/icons/icon-512.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "assets/icons/icon-192-maskable.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "assets/icons/icon-512-maskable.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],

"b2g_features": {
"version": "2.0.96",
"version": "2.0.98",
"id": "o.map",
"core": true,
"categories": ["utilities"],
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ rm ./application.zip
# Copy website files to docs directory
cd ..
cp -r application/* docs/
rm docs/manifest.webapp
Loading

0 comments on commit d041981

Please sign in to comment.