-
Notifications
You must be signed in to change notification settings - Fork 380
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
MapDataStore and POIs doesn't work as expected #792
Comments
You mean trying the SimpleDataStoreMapViewer example in Samples? The BTW which Mapsforge version? |
I use a MapDataStore-Layer like from SimpleDataStoreMapViewer as a additional layer in a modified DownloadLayerViewer example. I use the latest (from today) dev Version. |
As additional information: Currently i always purge the tile cache on application start. So it looks like the engine simple ignores new POIs and only redraw if the tile cache is empty. |
If you follow Mapsforge life cycle the cache is cleared on exit (unless you use persistent tile cache). |
Yes, i know. But how i can force a tile redraw if there is new data available to draw? It seems the requestRedraw currently doesn't work with the tile cache. It simple ignore the timestamp. If i purge the tile cache before i call requestRedraw the new data is drawn. |
There are two caches, the memory and the file cache (persistent or not). If the map is changed after it was rendered and cached, then depending on which caches you declared on its creation, you may need to reinitialized them too. Regular redraw works normally with overlays on top of map. |
I can't reinitialize the overlay every some seconds because the cache ignores the timestamp. Is there any other meaning for the timestamp as to tell the cache that he should junk the tile, in memory or as file, and redraw it? |
You can debug the |
The TileRendererLayer.isTileStale is true but the tile still exists in the tileCache and the if-clause in TileLayer fails because !this.tileCache.containsKey(job).
a is true If i remove c the job is added but not redrawn. |
The line in TileLayer if (isTileStale(tile, bitmap) && this.hasJobQueue && !this.tileCache.containsKey(job)) { should be changed to if (this.hasJobQueue && (isTileStale(tile, bitmap) || !this.tileCache.containsKey(job))) { So the job is added on a new timestamp or if the tile doesn't exist in the tile cache. And thats the point i'm out. I have no clue from the tile/redraw engine. I hope this helps and the problem can be fixed. |
Thanks for the debugging, will need to check it. Reminder: and see if that alters library behavior in other places. |
For your reminder: The AndroidTileBitmap.isExpired function returns the wrong value if expiration is set. This cause heavy redraw action for TileDownloadLayers with my changes. |
The next thing i see. If a tile from a TileDownloadLayer is expired it would not get downloaded on a requestRedraw(). It will end up in TileDownloadThread.doWork but there is no expiration check and only the tileCache.containsKey check which is always true. |
All these with persistent cache? Because I don't recall we had an expiration mechanism before introducing that feature. |
Yes with persistent cache. It was a bitmap with expiration = 0 and a timestamp in the past that got expired. Because my changes it was every time added to the queue on requestRedraw. But it ended up in TileDownloadThread.doWork but there is no expiration check and the download never start. |
For reference the persistent cache forum topic and pull request. |
Ouch, i see. Looks like the timestamp thing and a cache behind a tile layer is "not well implemented" ;-). I would prefer a "force" flag in the job class to trigger the work independent of any wired label or cache stuff. |
As example of wired. I was wondering why my jobs don't get added to the joblist in the TileLayer.draw(). The reason was in MapWorkerPool.run(). The job was added to the queue but it never get executed or removed and because that all new jobs for this tile never get added because there was already a job for this tile in the queue. And the main reason for this mess is this if case: if (!this.tileCache.containsKey(rendererJob) || rendererJob.labelsOnly) i changed it to if (!this.tileCache.containsKey(rendererJob) || !rendererJob.labelsOnly) but redraw doesn't work. I think there is a deeper label or cache dependency that prevent any simple redraw of a simple POI as symbol. |
@ksaihtam is there anything else on that issue? |
The issue is still present in MapDataStore with dynamic pois. I moved away from MapDataStore and wrote my own simple layer to get it working. |
I have setup a MapDataStore with dynamic added/removed POIs without any labels or ways. I initialize the MapReadResult with a custom tag like "Tag("test", "test")" and my render rule is like:
<rule cat="none" e="node" k="test" v="test">
<symbol id="poi" src="assets:symbols/transport/airport.svg" display="always" />
<circle radius="1.45" scale-radius="true" fill="#000000" />
</rule>
So, the POI should be appear as a black circle and a symbol.
The getDataTimestamp from my MapDataStore class returns always the current timestamp. For the Tile Cache i tried a persistent and non-persistent tile cache without any changes. I also tried to purge the Tile Cache on application start but without success.
Now the problems:
Did i overlooked something or is it still a mapsforge problem?
The text was updated successfully, but these errors were encountered: