logo separator

[mkgmap-dev] Putting the DP code under the microscope

From Johann Gail johann.gail at gmx.de on Sat Jul 25 09:54:02 BST 2009

> Hi Johann,
>
> it is actually not what it seems to be. The douglasPeucker function is  
> called recursively. If the condition (maxDistance < allowedError) is  
> fulfilled, the current part of the way can be reduced to a line (in  
> case start- and endpoint are different points) or a point (in case  
> start- and endpoint are the same). So the "if (ab == 0)  
> points.remove(endIndex)" does not remove the endpoint of the whole  
> polygon, but only prevents the polygon to have consecutive identical  
> nodes if the original way has small "loops" in it. Wouldn't be that  
> uncommon for contour lines btw. Closed polygons stay closed unless  
> they are smaller than the allowedError, in which case they will reduce  
> to a single point and will be dropped later anyway.
>
>   

Ok, with your explanation it seems reasonable to me. I will gave it a 
try later.
> Some other observation about the DP code: I'm currently using the  
> "Straight version" instead of the "Node version" and I think the maps  
> look much nicer if zoomed out. I would recommend this as the standard  
> setting. The problem of T-crossings not lining up isn't that  
> prominent, because in resolution 24 the DP won't be applied at all and  
> in the other resolutions it is not that much noticeable (for me at  
> least).
>   
>
I've played with both versions and both of them have different 
advantages. This was the reason I included both of them into the patch. 
The straight line was the first attempt and does a good work with the 
default settings.
Later I increased the allowed error distance to reduce data more and 
speedup drawing speed of my etrex. In my working copy I increased the 
error distance this far, so that the line can differ one or two pixels 
on the display. With this the crossings doesn't match exactly anymore. 
Therefore I introduced the node version, which doesn't zap nodes of 
crossings.
A further development would be, to consider only nodes which are visible 
crossings at the current zoom level. I.e. if a residential connects to a 
big road and the residential is not visible at the current zoom level, 
then it is allowed to zap this node. This would straighten out lines at 
low zooms much more. But at the DP filter code I don't have this 
information available.

Btw.: there is another patch around, which merges lines before DP 
filtering them. This is reasonable for the highways at very low zoom 
levels, which could be simplified often to a sinlge line in the overview 
maps. (But only if they are not cut in segments from exit to exit).
If I find some time I will release an updated patch for it.

Regards,
Johann



More information about the mkgmap-dev mailing list