Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support offline maps and POIs #783

Closed
HarelM opened this issue Aug 15, 2018 · 28 comments
Closed

Support offline maps and POIs #783

HarelM opened this issue Aug 15, 2018 · 28 comments
Assignees
Labels
App Native application related issues enhancement High Needed but there's a work around

Comments

@HarelM
Copy link
Member

HarelM commented Aug 15, 2018

Feature

The following might be a good solution to offline tiles without requiring the user to download a huge file - which sometimes fail.
https://github.com/allartk/leaflet.offline
Or this:
https://github.com/robertomlsoares/leaflet-offline

@zstadler
Copy link
Member

If we want to support Oruxmaps's offline maps, with the known download issues, the following are starting points:

  • The MBTiles leaflet plugin has implemented fetching tiles from an SQLite DB. Clearly, the DB scheme are different than Oruxmaps offline maps scheme.
  • This comment describes how to use 512x512 pixel tiles, as is the case in Oruxmaps offline maps. However, this approach is not directly applicable to Oruxmaps, as its offline tiles are not necessarily aligned with the tile boundaries the the lower-level zoom.

@HarelM HarelM added enhancement High Needed but there's a work around labels Sep 2, 2018
@HarelM
Copy link
Member Author

HarelM commented Sep 9, 2018

Another thing to consider here is that if we implement rotate we'll need to switch to OpenLayers according to #669 - which has a cache layer built in.
http://workshops.boundlessgeo.com/openlayers3/layers/cached.html

@valleyofdawn valleyofdawn added the App Native application related issues label Sep 14, 2018
@HarelM
Copy link
Member Author

HarelM commented Sep 22, 2018

This feature will facilitate the entry point to looking into what's needed in order to work offline properly - it should work both with the regular browser and with the mobile app the same way.
In order to facilitate offline work the first thing that we need it to better hold the current state of the app so that we initially fetch it from local storage and then hydrate it from the server.
To do that we need a good framework.
Redux seems like it is battle proof and is used with react so it seems like a good idea to use it.
It also supports undo and redo almost out of the box which is needed for #402

@HarelM HarelM self-assigned this Sep 22, 2018
HarelM added a commit that referenced this issue Sep 22, 2018
… Support global undo instead of undo per route #402
HarelM added a commit that referenced this issue Sep 22, 2018
@HarelM
Copy link
Member Author

HarelM commented Sep 22, 2018

This is the angular implementation of it:
https://github.com/angular-redux/platform/tree/master/packages/store

@HarelM
Copy link
Member Author

HarelM commented Sep 29, 2018

This is an interesting answer related to vector tiles, openlayers and ionic (which is a superset of cordova)
https://gis.stackexchange.com/questions/237407/openlayers-support-for-vector-tiles-pbf-split-and-crop

@HarelM
Copy link
Member Author

HarelM commented Nov 21, 2018

Looking into database solution for offline usage the following is what I came across:
http://www.diva-portal.org/smash/get/diva2:1215529/FULLTEXT01.pdf
Need to investigate IndexDB with spatial capabilities.

@HarelM
Copy link
Member Author

HarelM commented Nov 21, 2018

Here's another interesting option: PouchDB - Seems like we need a solution to state management persistence for #669 anyway so it might be a good idea to take this issue into consideration.
The following page explains how this is possible, I think:
https://pouchdb.com/adapters.html
This might allow using Oruxmaps sqlite database file to be download to the device - and wrap it using Cordova and a OpenLayer custom XYZ Tile image layer:
See the following issue: openlayers/openlayers#3707
There's a lot of code, research and bugs involve in doing this, but it might work :-)

HarelM added a commit that referenced this issue Nov 23, 2018
@HarelM
Copy link
Member Author

HarelM commented Nov 27, 2018

Need to investigate this further due to performance issues with PouchDB and chrome.
https://malcoded.com/posts/angular-service-worker
https://angular.io/guide/service-worker-intro
https://angular.io/guide/service-worker-getting-started

HarelM added a commit that referenced this issue Dec 5, 2018
* Support map rotation #669 - initial commit. a complete rewrite of the site to use openlayer, still not complete. Resolves #402 - Support global undo instead of undo per route.

* Support map rotation #669 - lint fixes, added north icon.

* Support map rotation #669 - Fix compilation due to unused events.

* Support map rotation #669 - Remove events and some leaflet usages.

* Support map rotation #669 - Fix compilation, removed more $events.

* Support map rotation #669 - Fix compilation

* Support map rotation #669 - Fix compilation due to unneeded classes.

* Support map rotation #669 - remove some unused code.

* Support map rotation #669 - Added clustering and route recording, fixed tranlation typos, added missing translations, fixed other small stuff to make things work.

* Support map rotation #669 - added make all route points editable.

* Replaced wrench with 3 vertical dots. #669

* Support various clear route options #669

* Resolves #787 - Allow opening of a specific POI in a group.
Related to #669.

* Support map rotation #669 - Added mapserver support using xyz tiles.

* Support map rotation #669 - Added snapping back. removed unused code.

* Support map rotation #669 - bring back tests.

* Support map rotation #669 - small correction related to cordova.

* Support map rotation #669 - remove leaflet, fixed delete route, updated file saver.

* Support map rotation #669 - Fix lint.

* Support map rotation #669 - Fix tests.

* Support map rotation #669 - Split android and web builds

* Support map rotation #669 - Split build, fix yml.

* Support map rotation #669 - Fix compilation after lint required fixes  :-/

* Support map rotation #669 - Throw if angular build fails.

* Support map rotation #669 - Fix android build due to split

* Support map rotation #669 - Updated version to 8.0

* Support map rotation #669 - Added GPS location interaction.

* Support map rotation #669 - Moved most of the popups to be overlays.

* Support map rotation #669 - Fix production compilation

* #669 - Moved pure map components to a folder.

* #669 - fix compilation.

* Fixed issue with version in GPX and improve description of uploaded OSM trace.

* Support map rotation #669 - Added traces layer and ability to manipulate.

* Fixes #856 - Fix failing android builds

* Support map rotation #669 - Fix tests, fix issue with animation override when following GPS location.

* Support map rotation #669 - facilitate drag and drop of a file.

* Support map rotation #669 - Fix fit to bounds. Fix legend. Fix move to search results.

* Support map rotation #669 - add zoom animation for zoom-in/out

* Support map rotation #669 - remove unwanted OSM layer.

* Support map rotation #669 - Moved layers and user to state management.

* Support map rotation #669 - Make advance route actions under a ... button

* Support map rotation #669 - Fix lint

* Support map rotation #669 - Fix production build, remove opacity from base layer, changed opacity slider to be green.

* Support map rotation #669 - reverse route in route properties, fixed some mouse events, fixed visibilty of route.

* Support map rotation #669 - Fix toggle category layer causes collapse.

* Support map rotation #669 - Fix incorrect color and weight.

* Support map rotation #669 - Fix production compilation due to missing method.

* Error adding routes to OSM #848 - Might be related, but might be a different issue.

* Support map rotation #669 - add route direction

* Support map rotation #669 - show direction only in readonly mode, show route points only in route editing mode. emit null when dragging interaction to hide hover marker.

* Support map rotation #669 - Fix opening a file that has only markers.

* Support map rotation #669, Support offline tiles #783 - Added PouchDB, update technology stack

* #669 - Update reducer action decorator to hold all the relevant classes.

* Support map rotation #669 - Show searchresult marker, fix production build

* Support map rotation #669 - Fix lint, move search results to poi service.

* Support map rotation #669 - Improve search results icon and some errors.

* Support map rotation #669 - improve private POI UX. added icons to private POI back.

* Support map rotation #669 - support database writing in another thread.

* Support map rotation #669 - make sure font loads before anything else to prevent missing icons on the map.

* Avoid using environment but use running context instead.

* Support map rotation #669 - Fix issue with a segment with a single point.

* Support map rotation #669 - add tooltip to north-up

* Support map rotation #669 - do not store and read state when runnning inside iFrame.

* Support map rotation #669 - Add extra data indicator.

* Resolves  #861 - Update to angular 7

* Support map rotation #669 - Add coordinates and height to private POI dialog. remove comments, added some TODOs.

* Update to angular 7 #861 - Update typescript to 3.1.6, remove unused import.

* Update to angular 7 #861 - remove css files to reduce build time? change appveyor worker cloud

* Support map rotation #669 - Small fix to route editing.

* Update to angular 7 #861 - downgrade to 7.0.4 to check if this solves build issues.

* Another attempt to fix appveyor run...

* Support map rotation #669 - Make recording work.

* Support map rotation #669 - fixed issue with undo.
Update to angular 7 #861 - reduce angular-cli back to 6.1.6 to prevent out of memory.

* Update to angular 7 #861 - Increase memory limit to all commands.

* Update to angular 7 #861 - Update typescript for cli.

* Update to angular 7 #861 - Fix lint.

* Fixes #866 - Geo-tagged images won't open (beta)

* Moved to ngx-openlayers next version. #669
@HarelM
Copy link
Member Author

HarelM commented Dec 12, 2018

Performance issues were fixed using worker-pouch repository.

Here's what I think is needed in order to make OruxMaps work with IHM app:

  1. Be able to query a sqlite file that is one the device, probably using this plug-in. There's an example app that can be used for initial testing on the device which should allow basic operations to the database here.
  2. Reverse engineer the OruxMaps Sqlite format and understand how to get a specific tile according to a given X,Y,Z coordinates.
  3. Once we can read the file there will be a need to implement a tile provider for openlayers, described somewhat here.
  4. If all the above are working there will be a need to wire this through the layers sidebar navigation to allow users to download a file or use a file that is already on the device.

@HarelM HarelM changed the title Support offline tiles Support offline usage Dec 14, 2018
HarelM added a commit that referenced this issue Dec 14, 2018
@HarelM
Copy link
Member Author

HarelM commented Jan 1, 2019

https://www.google.com/amp/s/mobilegeo.wordpress.com/2013/06/07/mbtiles-and-openlayers/amp/
This is an interesting piece on exactly what we need, I think.

@zstadler
Copy link
Member

zstadler commented Jan 2, 2019

As far as I understand, this example needs to be converted from raster tiles to vector tiles.

@HarelM
Copy link
Member Author

HarelM commented Jan 2, 2019

Seems about right, this explains why I couldn't find where the style is being applied. I'm not sure how to use this code for vector tiles, but it will be fun to research :-)

@HarelM
Copy link
Member Author

HarelM commented Jan 3, 2019

The following issue might show a way to use vector tiles with custom source, there's a codepen there that might be good:

openlayers/openlayers#7342
openlayers/openlayers#5198

@HarelM
Copy link
Member Author

HarelM commented Jan 3, 2019

In order to insert a mbtiles to websql and "fool" chrome to think it is part of the site the following steps are needed:

  1. write the following line in the initialization function of the app:
let db = openDatabase("tiles", 1.0, "tiles_db", 100 * 1024 * 1024, (database) => {
            console.log("DB opened!");
        });

This will create a database in chrome's application data folder, somewhere here:
C:\Users\my-user\AppData\Local\Google\Chrome\User Data\Default\databases\http_localhost_58231
Now the file can be replaced with the mbtiles file and chrome will be able to access it using the method above.

When this will be matured the following library maybe of use:
https://github.com/orbitaloop/WebSqlSync

HarelM referenced this issue Oct 17, 2019
HarelM added a commit that referenced this issue Nov 14, 2019
HarelM added a commit that referenced this issue Nov 30, 2019
…he process of creating it in the server and loading in the UI. updated offline sprite.
@HarelM
Copy link
Member Author

HarelM commented Nov 30, 2019

Things I would like to finish as part of this issue, other items probably should have their own issue in order to discuss them there since this feature is already too long:

  1. Support offline POI images - low resolution.
  2. Make sure add/update POI was not broken as part of this change.
  3. Define UX for offline - i.e. what the user would see when the app knows it is offline (now supported).

HarelM added a commit that referenced this issue Dec 2, 2019
HarelM added a commit that referenced this issue Dec 2, 2019
…luding images, added some of the online images the app uses.

Added offline icon. Fixed tests and lint.
@HarelM
Copy link
Member Author

HarelM commented Dec 3, 2019

Remaining for this issue before closing it:

  1. Make sure add/update POI was not broken as part of this change.
  2. Make sure server interval update is keeping the database up-to-date (so that rebuild results are identical).
  3. Add elevation and ITM grid data to POIs (should work the same for online and offline and reduce server calls).
  4. Source image link should be local and not remote to present the relevant icon for link or hide links.

Other issues:

  1. Allow saving to regular file when offline (currently the file is created in the server since it uploads images to imgur and does the conversion to GPX there).
  2. Conversion from of public POIs' features without using the server ("+" sign) - this should be more simple.
  3. Refresh map when returning from offline to online - I'm not sure this is easily possible...
  4. Offline editing of public POIs and sync when going back to online.
  5. Offline routing - huge effort, not sure what's the use case that justify it.
  6. Offline search - large effort, not sure the use case of searching while offline justifies it.
  7. Offline save as - I don't think it's needed.
  8. Offline share creation - not sure how this will work, probably not needed.
  9. Offline user shares/traces interaction - medium effort - not sure it is justified.

I believe these are all the abilities of the site that needs the server right now.

@HarelM HarelM changed the title Support offline usage Support offline maps and POIs Dec 6, 2019
HarelM added a commit that referenced this issue Dec 7, 2019
#783 - Fixed elevation, itm coordinates and length.
HarelM added a commit that referenced this issue Dec 13, 2019
…everted to elastic 5.6 due to issues with highways search.
HarelM added a commit that referenced this issue Dec 13, 2019
@HarelM
Copy link
Member Author

HarelM commented Dec 17, 2019

Current implementation allows initial testing of offline maps and POIs, no further development is expected as part of this feature. Further development will be split to other issues as needed.

@zstadler
Copy link
Member

I don't know if this is related to the refactoring, but...

The English version of the site has a Wikipedia POI here for which there is no OSM node. There is no such POI in the Hebrew version of the site. Both Wikipedia languages have an Image.

Ref:

@HarelM
Copy link
Member Author

HarelM commented Jan 14, 2020

The refactoring might have affected this, but this issue is now resolved. It will be better to open another issue on this subject so this won't get lost.
There are actually two OSM elements that should be linked to the above Wikipedia entries:
Not really sure how to map fix this right:
https://www.openstreetmap.org/node/5605113504
https://www.openstreetmap.org/way/218656641
Feel free to fix the mapping first so we can see how the merge behaves with a correct mapping.

HarelM added a commit that referenced this issue Jan 30, 2020
HarelM added a commit that referenced this issue Feb 2, 2020
HarelM added a commit that referenced this issue Feb 2, 2020
HarelM added a commit that referenced this issue Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Native application related issues enhancement High Needed but there's a work around
Projects
None yet
Development

No branches or pull requests

3 participants