Add offline cache

Bug #1276658 reported by Sam Bull
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qtlocation-opensource-src (Ubuntu)
Fix Released
Critical
Cris Dywan

Bug Description

The app should be able to cache downloaded tiles to be used in future runs of the app.

In contrast to the download tile pack feature, that allows downloading a region before going on holiday; this would provide faster viewing of previously viewed areas especially when the user has poor signal, as well as less bandwidth usage etc.

At present, the QML component caches downloaded tiles while the app is running, but upon closing the app this is all forgotten, and it must download from scratch again the next time it is loaded. So, tiles should be stored in a permanent cache, so that it is not required to download them everytime the app is started.

Note: Similar apps allow the user to specify the size of the cache, to meet their requirements. So, they can set the cache size to 1MB or 500MB etc. depending on their needs.

https://bugreports.qt-project.org/browse/QTBUG-41187

Tags: patch rtm14
Revision history for this message
ybon (yohanboniface) wrote :

Not sure what QtLocations handles exactly by default, but I'm seeing just now on the logs:

"Unable to write tile cache file "/home/phablet/.tilecache/queue1"
"Unable to write tile cache file "/home/phablet/.tilecache/queue2"
...

So certainly fixing this will help. Maybe be a apparmor policy missing.

Revision history for this message
ybon (yohanboniface) wrote :

This should have been fixed when upgrading to Qt5.2 SDK.
Seems to work for me.
Please reopen if it's not the case for you.

Changed in osmtouch:
status: New → Fix Released
Revision history for this message
Sam Bull (dreamsorcerer) wrote :

I can confirm this appears to be working. The caching of tiles appears slightly random, but works reasonably well. Would still be nice to be able to customise how much space it uses for caching, but if it's not something exposed by QtLocations, then it's probably not worth the effort to implement.

Revision history for this message
ybon (yohanboniface) wrote :

It's not working any more. Need to investigate why.

Changed in osmtouch:
status: Fix Released → Confirmed
Revision history for this message
ybon (yohanboniface) wrote :
Download full text (4.7 KiB)

For the record:

2014-08-15 18:17:31 ybon jdstrand: QtLocation seems to store cache in QStandardPaths::GenericCacheLocation is that a constant familiar for you?
2014-08-15 18:17:45 ybon cf http://qt-project.org/doc/qt-5/qstandardpaths.html
2014-08-15 18:18:46 jdstrand ybon: I am going to point you at kalikiana. he made sure that all this worked right in other parts of the toolkit
2014-08-15 18:19:20 ybon jdstrand: thanks :)
2014-08-15 18:19:26 ybon kalikiana: around by chance? :)
2014-08-15 18:19:45 jdstrand ybon: can you paste the path that QtLocation is using which is getting denied by apparmor for kalikiana?
2014-08-15 18:19:54 ybon sure
2014-08-15 18:20:09 ybon for reference, the line in the QtLocation I'm refering to http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/utopic/qtlocation-opensource-src/utopic-proposed/view/head:/src/location/maps/qgeotilecache.cpp#L119
2014-08-15 18:21:12 ybon kalikiana, jdstrand: here is the path /home/phablet/.cache/QtLocation/
2014-08-15 18:22:45 jdstrand kalikiana: I've not looked personally, but it appears QtLocation may not be honoring applicationName or similar
2014-08-15 18:22:53 jdstrand ybon: you are using location-service?
2014-08-15 18:23:11 ybon jdstrand: I'm not sure what you call location-service
2014-08-15 18:23:13 jdstrand well, I think QtLocation is supposed to use location-service
2014-08-15 18:23:16 ybon I'm using a QtMap object
2014-08-15 18:23:18 ybon with a plugin
2014-08-15 18:23:49 jdstrand kalikiana: might need to ask tvoss if you are curious about location-service
2014-08-15 18:23:50 ybon here is the code https://github.com/yohanboniface/OSMTouch/blob/master/OSMTouch.qml#L80
2014-08-15 18:28:07 kalikiana ybon: that code is technically correct, xdg_cache_home is shared on the desktop - jdstrand I can't check right now, is it set on the phone? It's expected that no app name is passed but it must be set by our launcher I think
2014-08-15 18:29:33 jdstrand kalikiana: I'm not sure. ybon asked me about the denial and I said that the denial should not be fixed and that applicationName was probably not correctly set.
2014-08-15 18:29:49 ybon I sware it's set :)
2014-08-15 18:29:55 jdstrand right
2014-08-15 18:29:57 ybon https://github.com/yohanboniface/OSMTouch/blob/master/OSMTouch.qml#L24
2014-08-15 18:30:06 jdstrand which is why I pointed you at kalikiana
2014-08-15 18:30:09 ybon maybe it's not done the proper way, though
2014-08-15 18:30:33 jdstrand that looks ok to me
2014-08-15 18:30:51 jdstrand ybon: does it use an C++ or is it all qml?
2014-08-15 18:30:58 ybon all qml
2014-08-15 18:31:08 jdstrand yeah, that is all you should have to do
2014-08-15 18:31:11 jdstrand kalikiana: ^
2014-08-15 18:31:15 ybon I've no C++ licence yet
2014-08-15 18:31:43 jdstrand ybon: maybe file a bug and ping kalikiana so he can look at it when he has time?
2014-08-15 18:32:18 ybon kalikiana: I'm not sure to get you well, are you saying that ~/.cache is the expected final path? or that the QtLocation code is correct, but the QStandardPaths::GenericCacheLocation value is missing or something?
2014-08-15 18:32:41 ybon this is the related issue on OSMTouch https://bugs.launchpad.net/osmtouch/+bug/1276658
201...

Read more...

Changed in osmtouch:
assignee: nobody → Christian Dywan (kalikiana)
Revision history for this message
ybon (yohanboniface) wrote :

I see that I've some cached tiles on this folder:

# ls -1 ~/.cache/me.yohanboniface.osmtouch/QtLocation/ | wc -l
1346

Last modified file is from June 30, so it may give a hint.

Revision history for this message
Cris Dywan (kalikiana) wrote :

QtLocation definitely obeys XDG_CACHE_HOME:

env XDG_CACHE_HOME=/tmp qmlscene OSMTouch.qml
ls /tmp/QtLocation/

So the bug has to be in the environment variable setup on the phone.

affects: osmtouch → ubuntu-app-launch
Changed in ubuntu-app-launch:
assignee: Christian Dywan (kalikiana) → nobody
Revision history for this message
Cris Dywan (kalikiana) wrote :

http://bazaar.launchpad.net/~indicator-applet-developers/ubuntu-app-launch/trunk.14.10/view/head:/helpers.c#L512

This seems to use g_get_user_cache_dir() which will be ~/.cache causing QtLocation to make that ~/.cache/QtLocation - for confinement this has to be ~/.cache/APP_ID - it is indeed correct the way QtLocation uses it as on the desktop the folder is intended to be shared among all applications.

Zsombor Egri (zsombi)
Changed in ubuntu-app-launch:
importance: Undecided → Critical
tags: added: rtm14
Cris Dywan (kalikiana)
affects: ubuntu-app-launch → qtlocation-opensource-src (Ubuntu)
Changed in qtlocation-opensource-src (Ubuntu):
assignee: nobody → Christian Dywan (kalikiana)
Cris Dywan (kalikiana)
Changed in qtlocation-opensource-src (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "appSpecificTileCache.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Cris Dywan (kalikiana)
description: updated
Revision history for this message
Cris Dywan (kalikiana) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtlocation-opensource-src - 5.3.0-0ubuntu4

---------------
qtlocation-opensource-src (5.3.0-0ubuntu4) utopic; urgency=medium

  [ Christian Dywan ]
  * Add debian/patches/appSpecificTileCache.diff (LP: #1276658)
 -- Timo Jyrinki <email address hidden> Tue, 09 Sep 2014 06:55:28 +0000

Changed in qtlocation-opensource-src (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.