[mkgmap-dev] higher precision instead of short-arc-removal?
From WanMil wmgcnfg at web.de on Thu Oct 3 16:58:26 BST 2013
> Hi programmers, > > I am still working on the improved short-arc-removal routines. > I found a few more special cases, and many of them are > related to the fact that we are using the rounded > lat/lon values (Garmin map units). > > Short excurse: > A map unit is a 24bit integer value, means we can separate 2^24 = 16777216 > different > positions on the equator. > By the way, the comment in Utils.toMapUnit > "A map unit is an integer value that is 1/(2^24) degrees of latitude or > longitue" > is wrong, we store 1/(2^23) of a value that goes from -180.0 to 180.0. > > Means ~ 2.39m (40075 km / 16777216) near the equator. > In Berlin, the value is ~ 1.45m for lon (lat is of course the same). > So, the rounding error is 0.75 to 1.2m in this area. > While these errors are not important when > it comes to rendering a map, they might be important > when it comes to routing. > > In some cases I find segments of ways with two points that are very close. > Imagine a nearly vertical short segment. The rounding might move > one point to the left, the other to the right, so that (in map units) > with deltaLat = 1 and deltaLon = 1 the calculated bearing of ~ 148 > is nonsense, as the real value is e.g 178. > > If I got this right, the Garmin routing algo uses the > bearing value. We store it (heavily rounded to 8 or fewer bits), > and the comments in RouteArc.encodeCurve() > say that we are not sure about the img format. > > I think this might also explain > why short arcs cause trouble, maybe it is not the > short arc itself, maybe we simply write wrong > data to the img when we store roads with > points that are very close to each other? > > If that is true, we might better try to find > out what we have to write to the img > instead of messing around with short arcs? > > If only precision is the problem: > Maybe we can Coord to store the > lat/lon values with 30 bits precision? > > Gerd > Hi Gerd, interesting idea to increase the precision of coordinates. I sometimes thought about using "real" coordinates but using doubles instead of int seemed to be too much memory overhead. Increasing the precision to 30 bits seems to be a much better way. The crucial point is: does the higher precision really help? In the end you also have to convert the high precision coordinates to the garmin precision. At this point I guess you will have the short arcs problem again? Of course the calculation of the bearings will be better. But this will not fix an img format problem (if that exist). So what about a systematic check the encodeCurve() method first? Would it be possible to create an map where all possible headings are encoded? In this case it might be possible to find out problematic values?! WanMil
- Previous message: [mkgmap-dev] higher precision instead of short-arc-removal?
- Next message: [mkgmap-dev] higher precision instead of short-arc-removal?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list