# [mkgmap-dev] highway count not fixed yet... - merge-roads-branch

From WanMil wmgcnfg at web.de on Sat Sep 28 13:35:22 BST 2013

```Hi Gerd,

in my opinion recalculating the highway counter after removing the short
arcs should fix all problems, shouldn't it?

I've added three changes to the patch:
1. When calculating the highway count ways with duplicate id are not
considered. This avoid that all points of a duplicated way are preserved
by all filters.
I think this should be modified a bit. For the first and last point of
those ways the highway count should be increased and also all points
where another way is connected. I have no use case where this matters
but I think it is the "correct" counting?

2. I have added the problematic point in the error message of the
MapBuilder in case a node is not a CoordNode. Just having the way id
might not be enough information and the way also might have been merged.

3. I have moved the recalculation of the highway counters after the
merge procedure. This should not change anything but it avoids a problem
with merging...

WanMil

> Hi Felix, WanMil,
>
> attached is a patch that might solve the problem.  I was still not able
> to reproduce it, so
> it's just a guess: In a special case, we create a new Coord instance to
> replace a CoordPOI
> instance. This new instance has highway count = 0. A very special case
> might be that this point is later used to split the way, in that case it
> would
> have highwaycount=1 for a first or last point of a road.
> The patch increments the count when the coord is created.
>
> Gerd
>
>
> ------------------------------------------------------------------------
> Date: Fri, 27 Sep 2013 02:51:58 +0200
> From: extremecarver at gmail.com
> To: mkgmap-dev at lists.mkgmap.org.uk
> Subject: Re: [mkgmap-dev] highway count not fixed yet... -
>
> no, I don't use any roundabout command like options, but adjust turn
> headings?? -- see below for all commandline options. From style I don't
> call much except loads of continues and continue with action, as well as
>
> On the old version the only very occasional problem note I get is the
> following - in this case for Bayern (Germany Bundesland) Geofabrik extract:
> start compilation 21:45:44 Velomap bayern this is run58
> SEVERE (MapBuilder): c:\openmtbmap\maps\65260023.osm.pbf: possible
> routing problem: road end-points not both coordNodes:
> (http://www.openstreetmap.org/browse/way/156936823)
> SEVERE (MapBuilder): c:\openmtbmap\maps\65260023.osm.pbf: possible
> routing problem: road end-points not both coordNodes:
> (http://www.openstreetmap.org/browse/way/156936823)
>
>
> I'm using theese commandline options:
> start /low /b /wait java -jar -Xms6000M -Xmx10300M
> c:\openmtbmap\mkgmap.jar %max-jobs% %generate-sea% %precomp-seaxx%
> --reduce-point-density-polygon=6 --housenumbers --remove-short-arcs
> --polygon-size-limits="24:16, 23:14, 22:12, 21:11, 20:10, 19:9, 18:8,
> 17:7, 16:6, 15:5, 14:4, 13:3, 12:2, 11:0, 10:0"
> --description=openmtbmap_%abr% --show-profiles=1  %locationxx% --route
> --country-abbr=%abr% --country-name=%country% --mapname=%FID%0000
> --family-id=%FID% --product-id=1
> --series-name=openmtbmap_%country%_%date%
> --family-name=mtbmap_%abr%_%date% --tdbfile --overview-mapname=mapsetc
> --keep-going --area-name="%country%_%date%_openmtbmap.org" -c
> c:\openmtbmap\maps\template.%countryx% 7*.img >NUL
>
> with these variables in general:
> set generate-sea=--generate-sea --latin1
> set precomp-seaxx=--precomp-sea=c:\openmtbmap\maps\sea.zip
> set levels=--levels="0:24, 1:23, 2:22, 3:21, 4:20, 5:19, 6:18"
> --overview-levels="7:17, 8:16, 9:15, 10:14, 11:13, 12:12
>
> and for most countries:
> set indx=--index (not using index for Asia continent as asia continent
> with index was crashing in Basecamp/Mapsource very often, only few
> compiles actually worked)
> set max-jobs=--max-jobs=8 (for some countries 7 as I ran out of memory
> on them and server started to swap=slower)
> On 26.09.2013 21:57, Gerd Petermann wrote:
>
>     Hi WanMil,
>
>     at least we should know if options like frig-roundabout are used.
>     Afaik the default style will never touch these
>     routines. I guess Felix uses almost all.
>
>     Gerd
>
>      > Date: Thu, 26 Sep 2013 21:53:20 +0200
>      > From: wmgcnfg at web.de <mailto:wmgcnfg at web.de>
>      > To: mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > Subject: Re: [mkgmap-dev] highway count not fixed yet... -
>      >
>      > Yeah, I guess it should be possible to simplify them be
>      > reimplementation. But that's only a rough guess....
>      >
>      > A test case would be great to find the missing incHighwayCount()!
>      >
>      > > Hi WanMil,
>      > >
>      > > yes, first and last node should be coordNode, so the assert is ok.
>      > > Unfortunately, the data flow in StyledConverter is
>      > > so complex that it is difficult to say why the assertion is
>     triggered. I
>      > > guess one of the split routines is still
>      > > missing a call of incHighwayCount().
>      > >
>      > > Gerd
>      > >
>      > >
>      > > > Date: Thu, 26 Sep 2013 21:42:28 +0200
>      > > > From: wmgcnfg at web.de <mailto:wmgcnfg at web.de>
>      > > > To: mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > > > Subject: Re: [mkgmap-dev] highway count not fixed yet... -
>      > > >
>      > > > Yes, it is meant to reduce the number of CoordNodes because
>     that should
>      > > > reduce the size of the routing network and might have a
>     positive impact.
>      > > >
>      > > > The assertion reported by Felix seems to be a problem of the
>     highway
>      > > > count. The assertion checks if the first node of a MapRoad is a
>      > > > CoordNode. I think this is required, isn't is?
>      > > > While writing I am thinking of no exit roads. What about
>      > > > think the first and the last point should also be a CoordNode?!?
>      > > >
>      > > > WanMil
>      > > >
>      > > > > Hi WanMil,
>      > > > >
>      > > > > yes, it will not cause problems. On the other hand, if you
>     do it to
>      > > > > reduce the number of CoordNodes, we should try to have a
>     correct
>      > > > > counter. I think the short-arc-removal is not always correctly
>      > > > > maintaining it. I'll have a look at it tomorrow.
>      > > > >
>      > > > > Gerd
>      > > > >
>      > > > >
>      > > > >
>      > > > >
>      > > > > WanMil wrote
>      > > > >> Hi Gerd,
>      > > > >>
>      > > > >> decHighwayCount() is called only on the node where two
>      > > merged.
>      > > > >> So assuming that the highway count gives the number of
>      > > > >> calling this method in such a case should be ok.
>      > > > >>
>      > > > >> WanMil
>      > > > >>
>      > > > >>> Hi WanMil,
>      > > > >>>
>      > > > >>> reg. the highway count:
>      > > > >>> I guess you already noticed, but just to make sure:
>      > > > >>> In trunk the absolute value of the counter does not
>     really matter
>      > > > >>> as long as it is > 1 for each point that should be
>     converted to a
>      > > > >>> node. I think a lot of routines are calling
>      > > > >>> incHighwayCount() "just to make sure", so a node where two
>      > > > >>> arcs meet might have a counter > 2.
>      > > > >>> You have introduced decHighwayCount(), so now
>      > > > >>> each place where this counter is incremented has
>      > > > >>> to be double checked.
>      > > > >>>
>      > > > >>> Gerd
>      > > > >>>
>      > > > >>>
>      > > > >>> WanMil wrote
>      > > > >>>> Ok, but I need some food (style, data etc.) to reproduce
>     it...
>      > > > >>>>
>      > > > >>>>> Just cannot find the topic on the merge-roads-branch.
>      > > > >>>>>
>      > > > >>>>> Is it known that the highway count error is not fully
>     fixed yet? I
>      > > > >>>>> still
>      > > > >>>>> get loads of them.
>      > > > >>>>> _______________________________________________
>      > > > >>>>> mkgmap-dev mailing list
>      > > > >>>>>
>      > > > >>>
>      > > > >>>> mkgmap-dev at .org <mailto:mkgmap-dev at .org>
>      > > > >>>
>      > > > >>>>> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > > > >>>>>
>      > > > >>>>
>      > > > >>>> _______________________________________________
>      > > > >>>> mkgmap-dev mailing list
>      > > > >>>
>      > > > >>>> mkgmap-dev at .org <mailto:mkgmap-dev at .org>
>      > > > >>>
>      > > > >>>> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > > > >>>
>      > > > >>>
>      > > > >>>
>      > > > >>>
>      > > > >>>
>      > > > >>> --
>      > > > >>> View this message in context:
>      > > > >>>
>      > >
>      > > > >>> Sent from the Mkgmap Development mailing list archive at
>     Nabble.com.
>      > > > >>> _______________________________________________
>      > > > >>> mkgmap-dev mailing list
>      > > > >>>
>      > > > >
>      > > > >> mkgmap-dev at .org <mailto:mkgmap-dev at .org>
>      > > > >
>      > > > >>> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > > > >>>
>      > > > >>
>      > > > >> _______________________________________________
>      > > > >> mkgmap-dev mailing list
>      > > > >
>      > > > >> mkgmap-dev at .org <mailto:mkgmap-dev at .org>
>      > > > >
>      > > > >> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > > > >
>      > > > >
>      > > > >
>      > > > >
>      > > > >
>      > > > > --
>      > > > > View this message in context:
>      > >
>      > > > > Sent from the Mkgmap Development mailing list archive at
>     Nabble.com.
>      > > > > _______________________________________________
>      > > > > mkgmap-dev mailing list
>      > > > > mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > > > > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > > > >
>      > > >
>      > > > _______________________________________________
>      > > > mkgmap-dev mailing list
>      > > > mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > > > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > >
>      > >
>      > > _______________________________________________
>      > > mkgmap-dev mailing list
>      > > mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>      > >
>      >
>      > _______________________________________________
>      > mkgmap-dev mailing list
>      > mkgmap-dev at lists.mkgmap.org.uk
>     <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>      > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
>
>     _______________________________________________
>     mkgmap-dev mailing list
>     mkgmap-dev at lists.mkgmap.org.uk  <mailto:mkgmap-dev at lists.mkgmap.org.uk>
>     http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
>
>
> _______________________________________________ mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
>
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: reset-highway-count-v3.patch