Assertion when removing name/ref from way

I want to show bridges on my map but would like to remove their names so that when you mouseover them, it shows A5/Bridge rather than A5/A5 (assuming the road's ref is A5). However, if I try the following rule: highway=* & bridge=yes { delete 'name'; delete 'ref'; } [0x010107 continue resolution 24] I get an assertion: java.lang.AssertionError at uk.me.parabola.mkgmap.reader.osm.Tags.put(Tags.java:102) at uk.me.parabola.mkgmap.reader.osm.Tags.addExtraItems(Tags.java:299) at uk.me.parabola.mkgmap.reader.osm.Tags.access$300(Tags.java:41) at uk.me.parabola.mkgmap.reader.osm.Tags$1.hasNext(Tags.java:223) at uk.me.parabola.mkgmap.osmstyle.RuleSet.resolveType(RuleSet.java:72) at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:281) ... Is this a sensible way to remove the names? If not, what is? If the rule is good, why is it blowing up? Cheers, Mark

Quick update, I tried deleting just one of 'name' or 'ref' and it worked as expected so I think the problem lies with trying to delete more than one tag in the same action rule.

Hi Steve, I think I have found the problem in Tags.java that was causing the assertion when I tried to delete multiple tags. I believe the root cause was the fact that remove() would decrement size so it looked as if there was space but it didn't actually remove the key (as the comment there suggests that is not the place to do that). So later, when trying to add another tag, it looked as if there was space (because size had been decremented) but keyPos() returned null because all the slots in the key array were full. The attached patch fixes this issue by not decrementing size when a tag is deleted (the key will get "garbage collected" in ensureSpace() so that it will be removed when the arrays are grown) and size gets adjusted (see below). I also set size to 0 in ensureSpace() before copying the key/value pairs into the new arrays because put() will increment size when there isn't an existing value for that key (which there won't be when the arrays are being grown because they are newly allocated). Previously, when ensureSpace() copied the key/values into the new arrays size would have been incremented from its current value so that the arrays would look like they are almost full again straight away which means that they would be doubled in size for every couple of tags added (can that really be true?) Anyway, please check the attached patch for sanity as I don't profess to understand the tag stuff that well. Cheers, Mark

Using this patch, I am seeing better than 20% speed improvement when processing the Baltic map. YMMV. The amount of speed up is dependent on the density of tags. If your nodes/way are heavily tagged, you will see a speed benefit with this patch. It will also reduce VM required (I don't have any estimate of how much VM will be saved). If people test this and report back only success, I will commit the fixes. Mark

Hi Steve,
Anyway, please check the attached patch for sanity ...
Looks good to me. Thanks, will now finally gain the benefit of not wasting gobs of memory in the hash maps!
OK - now committed. It's just a stroke of luck that I stumbled across these issues, if I hadn't tried to delete a couple of tags from a way, they could have avoided discovery for a lot longer. Cheers, Mark
participants (2)
-
Mark Burton
-
Steve Ratcliffe