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

Render-theme with "mtb:scale:uphill" and "mtb:scale" displays wrong tags #353

Closed
mapsforge opened this issue Nov 6, 2014 · 8 comments
Closed

Comments

@mapsforge
Copy link
Owner

From frank.hu...@gmail.com on September 18, 2012 21:58:02

What steps will reproduce the problem? 1. Create a small xml (osm) file rttesttrack.xml, modify some tracks and add mtb:scale and mtb:scale:uphill tags. Tags should be different (e.g mtb:scale = 1, mtb:scale:uphill=2)

  1. Add the following lines after line 386 to the original tag-mapping.xml and save it as mtbtag-mapping.xml:

    <osm-tag key="mtb:scale" value="0" renderable="true" />
    <osm-tag key="mtb:scale" value="1" renderable="true" />
    <osm-tag key="mtb:scale" value="2" renderable="true" />
    <osm-tag key="mtb:scale" value="3" renderable="true" />
    <osm-tag key="mtb:scale" value="4" renderable="true" />
    
    <osm-tag key="mtb:scale:uphill" value="0" renderable="true" />
    <osm-tag key="mtb:scale:uphill" value="1" renderable="true" />
    <osm-tag key="mtb:scale:uphill" value="2" renderable="true" />
    <osm-tag key="mtb:scale:uphill" value="3" renderable="true" />
    <osm-tag key="mtb:scale:uphill" value="4" renderable="true" />
    
  2. Convert the modified osm file with osmosis/mapwriter:
    osmosis-0.40.1/bin/osmosis --rx file=rttesttrack.xml --mw file=rttesttrack.map
    bbox=48.48,9.17,48.5,9.19 tag-conf-file=mtbtag-mapping.xml

  3. Modify an existing render theme (I took the bluenight-theme from Locus forum), add the lines to show up symbols for MTB (for those interested, I tried to make the same symbols as in openmtbmap.org map for Garmin devices). I will not show all tags, but the idea is:

(I added the same rules for all scales (0 to 4) with the respective symbol)

  1. Opened Locus, used the new map file to show up the map with with the new tags shown as expected What is the expected output? What do you see instead? I do not see the correct tags. It looks like mtb:scale:uphill value overided the mtb:scale value: A track with mtb:scale set to 0 and mtb:scale:uphill set to 4 shows up with symbols for mtb:scale=4 and mtb:scale:uphill=4

The map shows up (also with other render themes), no errors. What version of the product are you using? On what operating system? I do use the current map-writer (0.30), osmosis 0.40.1 and Locus Pro 2.6.1 Please provide any additional information below. So far I did not check the MapViewer.apk. I will check this later and add my findings.

Original issue: http://code.google.com/p/mapsforge/issues/detail?id=353

@mapsforge
Copy link
Owner Author

From frank.hu...@gmail.com on September 18, 2012 13:15:40

I tried to see wheather I have the same issues with AdvancedMapViewer, but I can not load the render theme as I did it inside Locus. The render theme can not find the symbol file as within Locus at /sdcard/Locus/mapsVector/_themes.

I guess I need to adjust all file path settings before I can try to reproduce it without Locus.

@mapsforge
Copy link
Owner Author

From frank.hu...@gmail.com on September 19, 2012 12:26:04

AdvancedMapViewer.apk also shows the wrong symbols: a track tagged with mtb:scale=0 and mtb:scale:uphill=4 show up with symbols for mtb:scale=4 and mtb:scale:uphill=4

@mapsforge
Copy link
Owner Author

From menion.asamm on January 08, 2013 00:00:12

Hi,
problem found in PositiveMatcher and also NegativeMatcher object

point is, that library iterate over all keys and values separately. So when found key from one tag that match and value from different tag that match, it's result is true

solution is something like this

@Override
boolean matchesWay(List<Tag> tags, byte zoomLevel, Closed closed) {
    // basic checks
    if (this.zoomMin > zoomLevel || 
            this.zoomMax < zoomLevel ||
            !this.elementMatcher.matches(Element.WAY) || 
            !this.closedMatcher.matches(closed)) {
        return false;
    }

    // check key/values
    for (Tag tag : tags) {
        if (keyMatcher.matches(tag) && valueMatcher.matches(tag)) {
            return true;
        }
    }
    return false;
}

this do, that I check all tags separately if they match to key & value pair. For this need to be rewrote all matchers objects!

@mapsforge
Copy link
Owner Author

From LudwigBr...@gmail.com on January 13, 2013 19:40:51

I am currently looking into this. To make my life a bit easier, could you add some screenshots, a minimal mapfile with the mtb file in it and a theme?

I think I understand the issue and it should not be too difficult to fix.

Status: Accepted

@mapsforge
Copy link
Owner Author

From devemu...@gmail.com on March 19, 2013 07:28:02

Thilo

Is this issue corrected at the rewrite branch?

It also happens to me (using the master branch) at one of my custom maps and for now I use prefixes as described also at https://groups.google.com/forum/?fromgroups=#!topic/mapsforge-dev/l1sS1PC8qfM Thanks.

@mapsforge
Copy link
Owner Author

From openandr...@gmail.com on July 14, 2013 11:44:11

Question: is this solved in the rewrite?
It affects all yes/no pairs too.

Example: http://www.openstreetmap.org/?lat=47.276&lon=15.1144&zoom=13&layers=M The Gleinalmtunnel at the A9 in Austria, tagged as

  • tunnel=yes
  • oneway=no
    so the tunnel is rendered as "no", that means as ordinary road.
    With stripped oneway=no the tunnel renders correct.

In the meantime I clear all yes/no's that are not really necessary, however this is no solution. Assigning unique values to tags such as I do with the MTB:SCALE (like tunnel=t_yes/t_no) is no solution cause it leads to incompatible maps depending who is redering them.

@mapsforge
Copy link
Owner Author

From LudwigBr...@gmail.com on August 29, 2014 10:07:57

I just had another quick look at it and unfortunately this is not solved as easily as comment #3 suggests: the problem is basically that the connection between tag keys and tag values has been lost in the optimization process (that I do not really understand), so at that point we do not know what tag the "yes" (one of the more frequent value clashes) applies to.

@devemux86
Copy link
Collaborator

Fixed in #1366.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants