[OSM-dev] simplify ways/polygons in Java

Gabriel Ebner ge at gabrielebner.at
Tue Dec 25 23:18:08 GMT 2007


On Tue, Dec 25, 2007 at 09:58:40PM +0100, Marcus Wolschon wrote:
> I am looking for some java-code to simplify ways
> to generate simplified, pre-computed maps for low zoom-levels.
> (Like showing all of berlin or europe in Traveling Salesman
> after zooming out.)
> 
> Does anyone know of such code or a simple algorithm to implement?

You can take a look at the SimplifyWayAction in the utilsplugin, it uses
Douglas-Peucker.  That simple recursive algorithm simply takes a straight line
from the first point to the last point and looks for the farthest points from
that line.  If that node is farther than a specified tolerance, then it's
included in the simplified polyline; then we split the polyline at that point
and repeat for both parts.

  Gabriel.





More information about the dev mailing list