diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog index d8ab55482..a991d92fd 100644 --- a/apps/openstmap/ChangeLog +++ b/apps/openstmap/ChangeLog @@ -18,4 +18,5 @@ 0.15: Make track drawing an option (default off) 0.16: Draw waypoints, too. 0.17: With new Recorder app allow track to be drawn in the background - Switch tile layer URL for faster/more reliable map tiles \ No newline at end of file + Switch tile layer URL for faster/more reliable map tiles +0.18: Prefer map with highest resolution diff --git a/apps/openstmap/interface.html b/apps/openstmap/interface.html index 618c5822e..a8ed3d285 100644 --- a/apps/openstmap/interface.html +++ b/apps/openstmap/interface.html @@ -183,7 +183,7 @@ TODO: }).addTo(map); let marker = new L.marker(latlon).addTo(map); map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false}); - }, 100); + }, 500); } resolve(); }); diff --git a/apps/openstmap/metadata.json b/apps/openstmap/metadata.json index 97bc7cc05..f4e0f2729 100644 --- a/apps/openstmap/metadata.json +++ b/apps/openstmap/metadata.json @@ -2,7 +2,7 @@ "id": "openstmap", "name": "OpenStreetMap", "shortName": "OpenStMap", - "version": "0.17", + "version": "0.18", "description": "Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are. Once installed this also adds map functionality to `GPS Recorder` and `Recorder` apps", "readme": "README.md", "icon": "app.png", diff --git a/apps/openstmap/openstmap.js b/apps/openstmap/openstmap.js index 692344357..37f82a127 100644 --- a/apps/openstmap/openstmap.js +++ b/apps/openstmap/openstmap.js @@ -30,6 +30,7 @@ m.maps = require("Storage").list(/openstmap\.\d+\.json/).map(f=>{ map.center = Bangle.project({lat:map.lat,lon:map.lon}); return map; }); +m.maps.sort((a,b) => b.scale-a.scale); // sort by scale so highest resolution is drawn last // we base our start position on the middle of the first map m.map = m.maps[0]; m.scale = m.map.scale; // current scale (based on first map) diff --git a/apps/recorder/ChangeLog b/apps/recorder/ChangeLog index cdb7352f3..991b811cb 100644 --- a/apps/recorder/ChangeLog +++ b/apps/recorder/ChangeLog @@ -33,4 +33,5 @@ 0.25: Widget now has `isRecording()` for retrieving recording status. 0.26: Now record filename based on date 0.27: Fix first ever recorded filename being log0 (now all are dated) -0.28: Automatically create new track if the filename is different \ No newline at end of file +0.28: Automatically create new track if the filename is different +0.29: When plotting with OpenStMap scale map to track width & height diff --git a/apps/recorder/app.js b/apps/recorder/app.js index ca3eec525..a2218420a 100644 --- a/apps/recorder/app.js +++ b/apps/recorder/app.js @@ -224,6 +224,12 @@ function viewTrack(filename, info) { // Function to convert lat/lon to XY var getMapXY; if (info.qOSTM) { + // scale map to view full track + const max = Bangle.project({lat: info.maxLat, lon: info.maxLong}); + const min = Bangle.project({lat: info.minLat, lon: info.minLong}); + const scaleX = (max.x-min.x)/Bangle.appRect.w; + const scaleY = (max.y-min.y)/Bangle.appRect.h; + osm.scale = Math.ceil((scaleX > scaleY ? scaleX : scaleY)*1.1); // add 10% margin getMapXY = osm.latLonToXY.bind(osm); } else { getMapXY = function(lat, lon) { "ram" diff --git a/apps/recorder/metadata.json b/apps/recorder/metadata.json index 2f682016f..e714abf8d 100644 --- a/apps/recorder/metadata.json +++ b/apps/recorder/metadata.json @@ -2,7 +2,7 @@ "id": "recorder", "name": "Recorder", "shortName": "Recorder", - "version": "0.28", + "version": "0.29", "description": "Record GPS position, heart rate and more in the background, then download to your PC.", "icon": "app.png", "tags": "tool,outdoors,gps,widget",