Skip to content

Label layer with MapDataStoreLabelStore shows less symbols #1631

Description

@devemux86

When we use a label layer with label cache (e.g. LabelLayerUsingLabelCacheMapViewer)
or we do not use a label layer (e.g. SimplestMapViewer), we see the correct first 2 images.

When we use a label layer with MapDataStoreLabelStore (e.g. LabelLayerUsingMapDataStoreMapViewer),
we see the wrong third image with much less symbols.

Was always the case or it is a result of the map label / symbol improvements in #1579 #1586 #1588 ?

cc @Sublimis

Activity

  1. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    This seems to happen only with the blue symbols (e.g. parking, accommodation, etc.), can this be some clue?

  2. devemux86 commented on Jan 18, 2025

    @devemux86
    CollaboratorAuthor

    @Sublimis There are many parking symbols. They still appear, but much less.

  3. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    v0.22 is similar, so it was before that time

  4. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    @Sublimis There are many parking symbols. They still appear, but much less.

    Yes, but why only blue symbols and not brown symbols? There are no brown symbols in your screenshots, but zoom in a bit to convince yourself.

  5. devemux86 commented on Jan 18, 2025

    @devemux86
    CollaboratorAuthor

    Parking happens to have a lot of symbols, so the difference is clearly visible.

  6. devemux86 commented on Jan 18, 2025

    @devemux86
    CollaboratorAuthor

    I don't know if we really need the label layer as in the LabelLayerUsingMapDataStoreMapViewer implementation.

    Its simultaneous reading of map file can cause problems
    and it shows the symbols / labels with delay, especially with large maps.
    This makes it not usable in fast scroll / zoom actions.

  7. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    Really don't know. Is there something wrong with the algorithm of the MapDataStoreLabelStore.getVisibleItems()?

  8. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    Just don't remove MapDataStoreLabelStore, as direct rendering depends on it. It's better to have it like this than not have it at all. Hopefully this will be fixed at some point.

  9. Sublimis commented on Jan 18, 2025

    @Sublimis
    Contributor

    Really don't know. Is there something wrong with the algorithm of the MapDataStoreLabelStore.getVisibleItems()?

    Confirmed. It seems that missing symbols are never returned from that method.
    Can you or @ludwigb take a look into that? We only made cosmetic changes there.

  10. devemux86 commented on Jan 19, 2025

    @devemux86
    CollaboratorAuthor

    The reason is simple: line 72 mapDataStore.readLabels, i.e. pois and ways that have a name.

    It works correctly if we replace it with readMapData.

  11. added a commit that references this issue on Jan 19, 2025
    547afae
  12. added this to the 0.24.0 milestone on Jan 19, 2025
  13. added a commit that references this issue on Jan 19, 2025
    6c461a1
  14. 15 remaining items

  15. devemux86 commented on Jan 22, 2025

    @devemux86
    CollaboratorAuthor

    @Sublimis Maybe, as the other 2 Mapsforge themes are very simple and not maintained anymore.

    Tests better be done with Motorider and Elevate themes.
    Probably a polygon appears too early or other elements.
    Theme commit history will help here.

    In the past we had problems with forests in Germany map and lakes in Netherlands map.
    As both types have too many complex polygons and these countries have too many of them.

  16. MotoUKRider commented on Jan 23, 2025

    @MotoUKRider

    @Sublimis As you allude, the OAMaps are a different animal to Mapsforge, for example: Switzerland 980MB vs 296MB as they contain contours and extra data - There is also a definite "things appear early" rule in the tag-mapping as I noticed recently.

    I am not an Android programmer, so I don't have the dev/debug tools ready to go - I mainly edit the theme XML and keep pressing F5 in Cruiser Desktop (on Windoze) until I'm happy, then I load it into the Cruiser App. It's solid, reliable and I am fairly certain that any of the handful of "crashes" within Cruiser have been a result of other functions failing rather than trying to "confuse" the map rendering with the Bishop Knife Trick ™ on the zoom-in/out buttons 😆

    It sounds to me like there is a lot going on with OAMaps in terms of mapping data and what else may be appearing at earlier zoom levels. Perhaps if a crash in a specific area can be replicated, it may narrow-down the culprit tag?

    PS: Does this happen with a Mapsforge map, too?

  17. devemux86 commented on Jan 23, 2025

    @devemux86
    CollaboratorAuthor

    @MotoUKRider @Sublimis

    If render theme does not have zoom-min in a rule, then the zoom-appear of tag-mapping is used.
    (which could be a much smaller zoom than we want especially for map performance)

    OpenAndroMaps use a different tag-mapping available here.

  18. Sublimis commented on Jan 23, 2025

    @Sublimis
    Contributor

    So in essence, the MotoRider theme is not designed to be 100% OAM compatible, and basically only their Elevate/Elements themes are made that way? Sorry, didn't know that.

    In the end, it seems that this really is some kind of "out of resources" error at the HW level due to a lot of drawing, everything points to that, because the error goes away when we manipulate the number of paths drawn (by hacking the code). The good thing is that this only happens often on one older (albeit high-end) device, it seems that newer versions of Android are much harder to push into error. It is doable, unfortunately, but much harder.

    @MotoUKRider

    PS: Does this happen with a Mapsforge map, too?

    Will try, and let you know. Presumably it won't happen, or it will be much harder to achieve.

    Would you be so kind to take a look at #1641 and those black paths there. It's an OAM map, the black paths are normal roads, but it happens that at several zoom levels some roads look black. Is there perhaps a simple solution to this? This does not happen on Mapsforge maps, nor did it happen on OAM maps until several weeks ago.

  19. devemux86 commented on Jan 23, 2025

    @devemux86
    CollaboratorAuthor

    @Sublimis Some map providers like OpenAndroMaps or Freizeitkarte may adapt / merge some OSM tags
    in order to provide more or adapted information. So their maps usually work better with their themes.
    For more details see the OpenAndroMaps tag-transform.

    Mapsforge themes should always work with Mapsforge maps with the original OpenStreetMap tags.

  20. Sublimis commented on Jan 23, 2025

    @Sublimis
    Contributor

    I am not an Android programmer, so I don't have the dev/debug tools ready to go - I mainly edit the theme XML and keep pressing F5 in Cruiser Desktop (on Windoze) until I'm happy, then I load it into the Cruiser App. It's solid, reliable and I am fairly certain that any of the handful of "crashes" within Cruiser have been a result of other functions failing rather than trying to "confuse" the map rendering with the Bishop Knife Trick ™ on the zoom-in/out buttons 😆

    As a general rule of thumb, the more things drawn on the screen, the more resources are used, which is probably understandable. If at all possible through the rendering theme, the number of "things" drawn on the screen at one time should be as small as practically possible. We have to keep in mind that the map is "just" part of some application, and the application has to draw and do its own thing at the same time 🙂

  21. devemux86 commented on Jan 23, 2025

    @devemux86
    CollaboratorAuthor

    Also these are offline vector maps rendered in real time on mobile devices, so performance is very important.
    They are not online bitmap tiles that were already prerendered on powerful servers and we just download them.

  22. devemux86 commented on Jan 23, 2025

    @devemux86
    CollaboratorAuthor

    Would you be so kind to take a look at #1641 and those black paths there. It's an OAM map, the black paths are normal roads, but it happens that at several zoom levels some roads look black. Is there perhaps a simple solution to this? This does not happen on Mapsforge maps, nor did it happen on OAM maps until several weeks ago.

    These should be road casings (e.g. highway=service) without the road core.
    In Mapsforge maps they appear later.

    cc @MotoUKRider

  23. Sublimis commented on Jan 23, 2025

    @Sublimis
    Contributor

    PS: Does this happen with a Mapsforge map, too?

    Update: Unfortunately yes. And with the same effort, it's no harder to achieve...

  24. Sublimis commented on Jan 23, 2025

    @Sublimis
    Contributor

    These should be road casings (e.g. highway=service) without the road core.

    Exactly.

  25. MotoUKRider commented on Jan 23, 2025

    @MotoUKRider

    @Sublimis @devemux86 I have found+fixed the service road issue - as they are tagged to appear at zoom-14 in Mapsforge I have removed the old zoom-12+13 declarations (redundant for me as I'd never have seen them with a Mapsforge map!). OAMaps loaded them early because of those 2 entries in the theme and it's different tag-mapping rules.

    I have posted a fix of this here.

    There was no deliberate intention to have themes not work with other maps - there have been a few fixes specifically for OAMaps (ie: a contour lines "Layer") plus nosea for Freizeitkarte. I'll try maps from all 3 providers in future to ensure that what I see is what most people also see!

  26. devemux86 commented on Jan 23, 2025

    @devemux86
    CollaboratorAuthor

    @MotoUKRider Thanks, I merged it! 👍

  27. Sublimis commented on Jan 23, 2025

    @Sublimis
    Contributor

    That's great, thank you both!

  28. Sublimis commented on Jan 27, 2025

    @Sublimis
    Contributor

    @MotoUKRider #1644

    Aside from this small tweak, almost every possible synchronization and hack has been tried to fix the crash mentioned above, but to no avail. (╯°□°)╯︵ ┻━┻

    It remains a mystery how it is possible for one XML to cause a crash and another (*comparable) not, while changes in Java make no difference.

    (*) Comparable because the other (outdated themes) are no simpler than the Motorider themes. We counted the points and labels, they are comparable in the complexity of the drawing. It must be something else. (In case anyone is wondering, the number of points was in the range of 500'000-2'000'000, the number of paths about 5x less on average, and the number of labels about 100'000)

  29. Sublimis commented on Feb 23, 2025

    @Sublimis
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions