You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My view would be only to extract rectangles (not any more complicated shapes, they could be implemented in user code as subsets of a envelope).
With the current MapFile format in mind, I think the best way is to have two operations:
read(BoundingBox bbox)
read(Set tiles) where the set of tiles is a contiguous set of tiles that covers a rectangular area
In general these would be two very different operations but for the MapFile format the first one must essentially be implemented through the second. With the internal structure of the MapFile there would be two different cases (which makes it tricky):
all tiles fall onto a single base tile (meaning actually the operation on the MapFile we currently have already reads all the right data, it just filters most tiles out)
the tiles span multiple base tiles: in this case multiple requests must be made and combined.
I vaguely remember that there was a third case, ???
Returning too much data is known to cause memory problems.....
The read(Set) operation could then be used in the LabelLayer to get all the labels for the tiles visible on screen....
Commit 351f1d4 implements new retrieval functionality for the MapDataStore:
retrieval of POI data only
retrieval of Label data only. This includes POI data and all ways that have a name.
Additionally, all retrieval methods can now also be called on a area of tiles defined by an upperLeft and lowerRight tile. I thought this is better than having a Set of Tiles, as it is clearer that the area is contiguous.
By default, the implementations can simply combined retrieved data for an area of tiles or simply return all the data even though only POI or label data is required.
However, the MapFile implementation utilizes the storage mechanism to read POI and label data based on MapFile blocks, thus reading a MapFile only once to retrieve the data for multiple tiles. This could possibly be optimized further if I really understood the underlying file format.
These retrieval methods are used in the new implementation of a LabelLayer that does not cache the data from previous tile reads (less complexity, less memory overhead).
Well spotted, the naming is wrong and the method is duplicated. A hangover
from a previous version, before I folded things together.
Do we have an official ordering of methods? I usually shy away from
reordering as it makes diffs even more difficult to understand, but it
certainly does make sense here.
The default implementation of readLabels in MapDataStore does exactly the
same thing as readMap data. It is just so that derived classes work without
having to implement the interface. The recommendation is to provide a more
efficient etc implementation for each derived class.
My understanding was that the deduplicating uses the equals method on a
class, so that would test (if implemented correctly) if the elements are
different classes. Or what do you mean. (Reminder to self: check that in
MapFile the deduplicating is not used, as there should be no duplicates).
The MapDataStoreLabelStore retrieves new data if the underlying tile area
has changed. So just with a bit of moving around there will not be a new
retrieval, but when the tile area changes, then we have to retrieve the
full data for all visible tiles again. That is a big hit on performance as
the whole area will not be drawn until all data has been retrieved. This
could be improved by making the retrieval asynchronous, i.e. drawing the
data from the old set, while in a background thread retrieving the accurate
data for the viewport, then refreshing when that new data is in.
Trying to integrate the new LabelLayer without success (though Samples seems working).
Seeing random tiles without content and disappearing symbols / labels caused by many (Android):
Are you sharing a MapFile between the layers? Rather than opening a new
file?
The error actually comes from reading map data (not label data), so I
assume what is happening is that two layers read from the same file
descriptor, and thus move the same read position.
The Samples app (I just checked) opens the same MapFile twice, so the read
position is not shared.
org.mapsforge.map.reader.MapFile processWaysWARNING: invalid way tag ID: 8300org.mapsforge.map.reader.MapFile processPOIsWARNING: invalid POI tag ID: 123org.mapsforge.map.reader.MapFile processWayDataBlockWARNING: invalid number of way coordinate blocks: 1060691org.mapsforge.map.reader.MapFile processBlockWARNING: invalid first way offset: 1078554org.mapsforge.map.layer.renderer.DatabaseRenderer executeJobWARNING: invalid longitude: 1004.0364423125
—
Reply to this email directly or view it on GitHub #741 (comment)
.
I pushed a bit of cleanup plus a bug fix that relates to retrieval for
certain zoom ranges.
I think re speed we have the following problem: whenever we move the map,
the tile set changes, so we issue a new retrieval. However for panning over
wider areas this means retrievals get queued up and are executed
sequentially. For tiles this is probably not that much of an issue, but for
reads of larger areas this will take some time.
I really do not want to introduce any sort of caching here: while caching
could theoretically be speed improving (only fetch the tiles that are
missing), in the multi-threaded version we saw that actually OOM are our
biggest enemy. If we only had to cache pois it would not be that much of an
issue, but we also need to cache named ways for road labels .... take up
much more space.
Best would probably be drawing the old data set if there is still an
overlap of tiles and issue a single new request on background thread, then
refresh when data has arrived. Plus cancel requests if tile set has changed
again and is not being worked on yet.
Activity
LabelLayer: new implementation that reads data out of MapDataStore in…
ludwigb commentedon Dec 30, 2015
Commit 351f1d4 implements new retrieval functionality for the MapDataStore:
Additionally, all retrieval methods can now also be called on a area of tiles defined by an upperLeft and lowerRight tile. I thought this is better than having a Set of Tiles, as it is clearer that the area is contiguous.
By default, the implementations can simply combined retrieved data for an area of tiles or simply return all the data even though only POI or label data is required.
However, the MapFile implementation utilizes the storage mechanism to read POI and label data based on MapFile blocks, thus reading a MapFile only once to retrieve the data for multiple tiles. This could possibly be optimized further if I really understood the underlying file format.
These retrieval methods are used in the new implementation of a LabelLayer that does not cache the data from previous tile reads (less complexity, less memory overhead).
devemux86 commentedon Dec 30, 2015
Nice, will study the changes and start testing it.
devemux86 commentedon Dec 30, 2015
@ludwigb I see you use
assertin non Test classes and in public methods.Shouldn't it be better to use usual checks with thrown exceptions instead?
ludwigb commentedon Dec 30, 2015
Should probably be removed.
On 30 December 2015 at 12:35, Emux [email protected] wrote:
devemux86 commentedon Dec 30, 2015
MapFileimplementation is confusing me.We have readLabels which has redundant
selectorparameter, yet it's called also for poi data.(BTW methods sorting here would help better analysing the code)
ludwigb commentedon Dec 30, 2015
Well spotted, the naming is wrong and the method is duplicated. A hangover
from a previous version, before I folded things together.
Do we have an official ordering of methods? I usually shy away from
reordering as it makes diffs even more difficult to understand, but it
certainly does make sense here.
On 30 December 2015 at 15:37, Emux [email protected] wrote:
devemux86 commentedon Dec 31, 2015
As I dig deeper into the code, do you want me to make any changes or should I collect all my remarks and you'll review it afterwards?
We may have something in our IDE rules for contributors and I recall Thilo regularly did a code cleanup with sorting, etc.
I agree to that, we can just do it in separate commits with the usual label "no functionality change".
applantation commentedon Dec 31, 2015
I have been trying to get the Rearrange Code in Android Studio to actually
do what I want, but just applied to the MapFile file. Not quite there yet.
I will make the small changes you suggested cumulatively at one point,
please continue with comments.
Ludwig
On 31 December 2015 at 08:18, Emux [email protected] wrote:
devemux86 commentedon Dec 31, 2015
MapDataStorewe havereadLabelsandreadMapDatamethods doing the same thing. Do we actually need both of them (or required just forMapFile)?MapReadResultwe could try improving deduplication performance by using interfaces of distinct elements (depending on interface use).Overall the map rendering appears less smooth now (compared to old
LabelLayer). More tests are to be done for CPU / RAM performance.applantation commentedon Dec 31, 2015
The default implementation of readLabels in MapDataStore does exactly the
same thing as readMap data. It is just so that derived classes work without
having to implement the interface. The recommendation is to provide a more
efficient etc implementation for each derived class.
My understanding was that the deduplicating uses the equals method on a
class, so that would test (if implemented correctly) if the elements are
different classes. Or what do you mean. (Reminder to self: check that in
MapFile the deduplicating is not used, as there should be no duplicates).
The MapDataStoreLabelStore retrieves new data if the underlying tile area
has changed. So just with a bit of moving around there will not be a new
retrieval, but when the tile area changes, then we have to retrieve the
full data for all visible tiles again. That is a big hit on performance as
the whole area will not be drawn until all data has been retrieved. This
could be improved by making the retrieval asynchronous, i.e. drawing the
data from the old set, while in a background thread retrieving the accurate
data for the viewport, then refreshing when that new data is in.
Ludwig
On 31 December 2015 at 14:48, Emux [email protected] wrote:
devemux86 commentedon Jan 1, 2016
Trying to integrate the new
LabelLayerwithout success (though Samples seems working).Seeing random tiles without content and disappearing symbols / labels caused by many (Android):
devemux86 commentedon Jan 1, 2016
Also there are many (Java):
ludwigb commentedon Jan 1, 2016
Are you sharing a MapFile between the layers? Rather than opening a new
file?
The error actually comes from reading map data (not label data), so I
assume what is happening is that two layers read from the same file
descriptor, and thus move the same read position.
The Samples app (I just checked) opens the same MapFile twice, so the read
position is not shared.
Ludwig
On 1 January 2016 at 17:57, Emux [email protected] wrote:
devemux86 commentedon Jan 2, 2016
Yes that was the cause, I used the same map data store in renderer and label store like in old days.
Playing with it, I see occasionally (without visible artifacts):
Also the CPU usage continues to be quite high.
LabelLayer: cleanup, bugfixes, more tests for data retrieval from Map…
ludwigb commentedon Jan 4, 2016
I pushed a bit of cleanup plus a bug fix that relates to retrieval for
certain zoom ranges.
I think re speed we have the following problem: whenever we move the map,
the tile set changes, so we issue a new retrieval. However for panning over
wider areas this means retrievals get queued up and are executed
sequentially. For tiles this is probably not that much of an issue, but for
reads of larger areas this will take some time.
I really do not want to introduce any sort of caching here: while caching
could theoretically be speed improving (only fetch the tiles that are
missing), in the multi-threaded version we saw that actually OOM are our
biggest enemy. If we only had to cache pois it would not be that much of an
issue, but we also need to cache named ways for road labels .... take up
much more space.
Best would probably be drawing the old data set if there is still an
overlap of tiles and issue a single new request on background thread, then
refresh when data has arrived. Plus cancel requests if tile set has changed
again and is not being worked on yet.
Ludwig
On 2 January 2016 at 14:01, Emux [email protected] wrote:
devemux86 commentedon Jan 4, 2016
+1 for not resolving to cache again.
devemux86 commentedon Feb 6, 2016
@ludwigb we can close this?
MapFile: minor code improvements #741