<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>openstreetmap on Mister Muffin Blog</title>
    <link>http://blog.mister-muffin.de/tags/openstreetmap/</link>
    <description>Recent content in openstreetmap on Mister Muffin Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 03 Apr 2014 11:20:00 +0000</lastBuildDate><atom:link href="http://blog.mister-muffin.de/tags/openstreetmap/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>mapbender - maps for long-distance travels</title>
      <link>http://blog.mister-muffin.de/2014/04/03/mapbender---maps-for-long-distance-travels/</link>
      <pubDate>Thu, 03 Apr 2014 11:20:00 +0000</pubDate>
      
      <guid>http://blog.mister-muffin.de/2014/04/03/mapbender---maps-for-long-distance-travels/</guid>
      <description>&lt;p&gt;Back in 2007 I stumbled over the &amp;ldquo;Plus Fours Routefinder&amp;rdquo;, an invention of the
1920&amp;rsquo;s. It&amp;rsquo;s worn on the wrist and allows the user to scroll through a map of
the route they planned to take, rolled up on little wooden rollers.&lt;/p&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/plus_fours_routefinder.jpg&#34;&gt;
&lt;img src=&#34;http://blog.mister-muffin.de/thumbs/plus_fours_routefinder.jpg&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;At that point I thought: that&amp;rsquo;s awesome for long trips where you either dont
want to take electronics with you or where you are without any electricity for
a long time. And creating such rollable custom maps of your route automatically
using openstreetmap data should be a breeze! Nevertheless it seems nobody
picked up the idea.&lt;/p&gt;
&lt;p&gt;Years passed and in a few weeks I&amp;rsquo;ll go on a biking trip along the Weser, a
river in nothern Germany. For my last multi-day trip (which was through the
Odenwald, an area in southern Germany) I printed a big map from openstreetmap
data which contained the whole route. Openstreetmap data is fantastic for this
because in contrast to commercial maps it doesnt only allow you to just print
the area you need but also allows you to highlight your planned route and
objects you would probably not find in most commercial maps like for example
supermarkets to stock up on supplies or bicycle repair shops.&lt;/p&gt;
&lt;p&gt;Unfortunately such big maps have the disadvantage that to show everything in
the amount of detail that you want along your route, they have to be pretty
huge and thus easily become an inconvenience because the local plotter can&amp;rsquo;t
handle paper as large as DIN A0 or because it&amp;rsquo;s a pain to repeatedly fold and
unfold the whole thing every time you want to look at it. Strong winds are also
no fun with a huge sheet of paper in your hands. One solution would be to print
DIN A4 sized map regions in the desired scale. But that has the disadvantage
that either you find yourself going back and forth between subsequent pages
because you happen to be right at the border between two pages or you have to
print sufficiently large overlaps, resulting in many duplicate map pieces and
more pages of paper than you would like to carry with you.&lt;/p&gt;
&lt;p&gt;It was then that I remembered the &amp;ldquo;Plus Fours Routefinder&amp;rdquo; concept. Given a
predefined route it only shows what&amp;rsquo;s important to you: all things close to the
route you plan to travel along. Since it&amp;rsquo;s a long continuous roll of paper
there is no problem with folding because as you travel along the route you
unroll one end and roll up the other. And because it&amp;rsquo;s a long continuous map
there is also no need for flipping pages or large overlap regions. There is not
even the problem of not finding a big enough sheet of paper because multiple
DIN A4 sheets can easily be glued together at their ends to form a long roll.&lt;/p&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender1.png&#34;&gt;
&lt;img width=&#34;50%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender1.png&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;On the left you see the route we want to take: the bicycle route along the
Weser river. If I wanted to print that map on a scale that allows me to see
objects in sufficient detail along our route, then I would also see objects in
Hamburg (upper right corner) in the same amount of detail. Clearly a waste of
ink and paper as the route is never even close to Hamburg.&lt;/p&gt;
&lt;div style=&#34;clear:both&#34;&gt;&lt;/div&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender2.png&#34;&gt;
&lt;img width=&#34;50%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender2.png&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;As the first step, a smooth approximation of the route has to be found. It
seems that the best way to do that is to calculate a B-Spline curve
approximating the input data with a given smoothness. On the right you can see
the approximated curve with a smoothing value of 6. The curve is sampled into
20 linear segments. I calculated the B-Spline using the FITPACK library to
which scipy offers a Python binding.&lt;/p&gt;
&lt;div style=&#34;clear:both&#34;&gt;&lt;/div&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender3.png&#34;&gt;
&lt;img width=&#34;50%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender3.png&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;The next step is to expand each of the line segments into quadrilaterals. The
distance between the vertices of the quadrilaterals and the ends of the line
segment they belong to is the same along the whole path and obviously has to be
big enough such that every point along the route falls into one quadrilateral.
In this example, I draw only 20 quadrilaterals for visual clarity. In practice
one wants many more for a smoother approximation.&lt;/p&gt;
&lt;div style=&#34;clear:both&#34;&gt;&lt;/div&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender5.png&#34;&gt;
&lt;img width=&#34;12.5%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender5.png&#34; /&gt;
&lt;/a&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender4.png&#34;&gt;
&lt;img width=&#34;12.5%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender4.png&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;Using a simple transform, each point of the original map and the original path
in each quadrilateral is then mapped to a point inside the corresponding
&amp;ldquo;straight&amp;rdquo; rectangle. Each target rectangle has the height of the line segment
it corresponds to. It can be seen that while the large scale curvature of the
path is lost in the result, fine details remain perfectly visible. The
assumption here is, that while travelling a path several hundred kilometers
long, it does not matter that large scale curvature that one is not able to
perceive anyways is not preserved.&lt;/p&gt;
&lt;p&gt;The transformation is done on a Mercator projection of the map itself as well
as the data of the path. Therefore, this method probably doesnt work if you
plan to travel to one of the poles.&lt;/p&gt;
&lt;p&gt;Currently I transform openstreetmap bitmap data. This is not quite optimal as
it leads to text on the map being distorted. It would be just as easy to apply
the necessary transformations to raw openstreetmap XML data but unfortunately I
didnt find a way to render the resulting transformed map data as a raster image
without setting up a database. I would&amp;rsquo;ve thought that it would be possible to
have a standalone program reading openstreetmap XML and dumping out raster or
svg images without a round trip through a database. Furthermore,
&lt;a href=&#34;https://www.mapbox.com/tilemill/&#34;&gt;tilemill&lt;/a&gt;, one of the programs that seem to
be one of the least hasslesome to set up and produce raster images is stuck in
&lt;a href=&#34;https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644767&#34;&gt;an ITP&lt;/a&gt; and the
existing packaging attempt fails to produce a non-empty binary package. Since I
have no clue about nodejs packaging, &lt;a href=&#34;http://lists.alioth.debian.org/pipermail/pkg-javascript-devel/2014-April/007311.html&#34;&gt;I wrote about
this&lt;/a&gt;
to the pkg-javascript-devel list. Maybe I can find a kind soul to help me with
it.&lt;/p&gt;
&lt;div style=&#34;clear:both&#34;&gt;&lt;/div&gt;
&lt;a href=&#34;http://blog.mister-muffin.de/images/mapbender6.png&#34;&gt;
&lt;img width=&#34;50%&#34; style=&#34;float:right&#34; src=&#34;http://blog.mister-muffin.de/thumbs/mapbender6.png&#34; /&gt;
&lt;/a&gt;
&lt;p&gt;Here a side by side overview that doesnt include the underlying map data but
only the path. It shows how small details are preserved in the transformation.&lt;/p&gt;
&lt;p&gt;The code that produced the images in this post is very crude, unoptimized and
kinda messy. If you dont care, then it can be accessed
&lt;a href=&#34;https://github.com/josch/mapbender&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;div style=&#34;clear:both&#34;&gt;&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
