tag:blogger.com,1999:blog-47419701817147601872024-01-23T10:48:05.766+00:00master mapsBjørn Sandvikhttp://www.blogger.com/profile/09449118212462364491noreply@blogger.comBlogger146125tag:blogger.com,1999:blog-4741970181714760187.post-48037518744436696642016-09-09T17:33:00.003+01:002016-09-09T17:59:05.714+01:00Creating TINs in SAGA GIS<div dir="ltr" style="text-align: left;" trbidi="on">
This blog post is part of <a href="http://blog.thematicmapping.org/2016/09/creating-tin-from-raster-dem.html">an ongoing effort</a> to find the best open source tool for <span style="font-family: "\22 arial\22 "; white-space: pre-wrap;"><i>Triangulated Irregular Networks</i> (TINs). </span><br />
<br />
<a href="https://twitter.com/gisn8/status/773522731652509696">Nathan Saylor recommended me</a> to try <a href="http://www.saga-gis.org/">SAGA GIS</a>, which has various tools for <span style="font-family: "arial";"><span style="white-space: pre-wrap;">TINs</span></span>. I've never used SAGA before (<a href="https://live.osgeo.org/en/quickstart/saga_quickstart.html">here is a quickstart tutoria</a>l), and the first challenge was to get it running on my MacBook. The easiest option was to use Homebrew:<br />
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">brew tap osgeo/osgeo4mac</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">brew install saga-gis --with-app</span></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
I first converted my DEM into a grid format supported by SAGA, and also reduced the resolution from 10m to 100m to avoid out-of-memory issues on my laptop: </div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">gdal_translate -of GSBG -outsize 600 600 jotunheimen.tif jotunheimen_100m.grd</span></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
My SAGA installation is a bit rusty. I need to open the dataset twice ("File > Grid > Load" or by using the File System tree) before it actually loads. </div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-mmihKiqnIO8/V9Kijl1OrjI/AAAAAAAAuf4/fmvQWQf2-a0GQnru4S04mT5jv8-S6vVUwCLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B13.45.34.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-mmihKiqnIO8/V9Kijl1OrjI/AAAAAAAAuf4/fmvQWQf2-a0GQnru4S04mT5jv8-S6vVUwCLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B13.45.34.png" /></a></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
You'll see your dataset in the Data Manager. Above the datasets your see some numbers: </div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">100; 600x 600y; 432050x 6790050y</span></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
The first number is the cell size (100 meters), the next two numbers show the number of cells in x and y direction (600 x 600 px), and the last two numbers are the origin of the grid (my dataset is in UTM 32N). </div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
You'll find the TIN tools under Geoprocessing > TIN > Conversion: </div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://4.bp.blogspot.com/-mcgr3TPMi34/V9B937jAjwI/AAAAAAAAue8/wGKaFN8j9fADhWIcxbxcuenGM3WHJfqEgCLcB/s1600/Screen%2BShot%2B2016-09-07%2Bat%2B22.50.25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="91" src="https://4.bp.blogspot.com/-mcgr3TPMi34/V9B937jAjwI/AAAAAAAAue8/wGKaFN8j9fADhWIcxbxcuenGM3WHJfqEgCLcB/s640/Screen%2BShot%2B2016-09-07%2Bat%2B22.50.25.png" width="640" /></a> </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Unfortunately, the tools are <a href="https://sourceforge.net/p/saga-gis/wiki/tin_tools/">poorly documented</a>, so we need to experiment a bit. When I tried "Grid to TIN" I got (599 x 599 * 2 = 717,602 triangles for my 600 x 600 = 360,000 pixels, which is not very efficient. This is similar to the technique I used to <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs.html">create a triangle mesh in three.js</a>. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-YNmjp6T_QLc/V9LVD2CJUgI/AAAAAAAAugQ/lCjnWbO0bY8JL1o_9qqcSBVkMZfsj2vsQCLcB/s1600/structure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-YNmjp6T_QLc/V9LVD2CJUgI/AAAAAAAAugQ/lCjnWbO0bY8JL1o_9qqcSBVkMZfsj2vsQCLcB/s1600/structure.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
We need to to better, and "Grid to TIN (Surface Specific Points)" gives you some more options:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-lHPJf2A3I8o/V9LWh55WmCI/AAAAAAAAugU/9d9oCbqMMHQqArH0ejmApcRmJd6huqDdgCLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B17.33.40.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-lHPJf2A3I8o/V9LWh55WmCI/AAAAAAAAugU/9d9oCbqMMHQqArH0ejmApcRmJd6huqDdgCLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B17.33.40.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I'm not sure how the different methods are working, and if they can be combined by setting different thresholds below. Please give me some hints if you know some theory and best practices for terrains like this. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I first used the defaults (Opposite Neighbours). I'm not friends yet with the map/3D-viewer of SAGA, so I'm exporting my TIN so I can enjoy it in other applications. The export tool is hidden under Geoprocessing > File -> Shapes -> Exports -> Export TIN to Stereo Lithography File (STL). </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-bCgvcV875n0/V9La1a-jWSI/AAAAAAAAugg/Mi84xVbxGAcAd-2XDfHZZL-8nixF4ImUACLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B17.51.33.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-bCgvcV875n0/V9La1a-jWSI/AAAAAAAAugg/Mi84xVbxGAcAd-2XDfHZZL-8nixF4ImUACLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B17.51.33.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I then opened the file in <a href="http://meshlab.sourceforge.net/">MeshLab</a>:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-4LM2Ci-LRT4/V9LgAEPt62I/AAAAAAAAugw/KU16cx_Q-7cCYZVa8qNmSS6o2tt4AVrnACLcB/s1600/Screen%2BShot%2B2016-09-09%2Bat%2B18.13.43.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="404" src="https://4.bp.blogspot.com/-4LM2Ci-LRT4/V9LgAEPt62I/AAAAAAAAugw/KU16cx_Q-7cCYZVa8qNmSS6o2tt4AVrnACLcB/s640/Screen%2BShot%2B2016-09-09%2Bat%2B18.13.43.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Ok, it's promising, you can clearly see the big triangles for lakes, and smaller triangles when the terrain is rough. I got 172,128 triangles, about one-forth of a regular mesh. But it's not good enough, as I see that parts of the lakes are not horizontal. Which settings should I use to fix it? </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Still needs investigation: </div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li>Is it possible to run TIN functions from SAGA on the command line? Does <a href="https://sourceforge.net/p/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD/">SAGA CMD</a> work on Mac? </li>
<li>How big dataset can SAGA handle? </li>
</ul>
<div>
<i><br /></i>
<i>Do you want to contribute to this tutorial? Please add your comments below! </i></div>
</div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-4741970181714760187.post-77659252573985963012016-09-07T16:56:00.000+01:002017-03-04T11:59:19.235+00:00Creating a TIN from a raster DEM<div dir="ltr" style="text-align: left;" trbidi="on">
<span id="docs-internal-guid-5e373a9d-054a-7688-c3d0-9dd1f556894d"><span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;">NB! This blog post will constantly change until I find a good open source solution to create a Triangulated Irregular Network (TIN) from a Digital Elevation Model (DEM). Would you like to help? Please add a comment below!</span></span><br />
<span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;">NEW! </span><span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;"><a href="http://blog.thematicmapping.org/2016/09/creating-tins-in-saga-gis.html">Read the first test of the TIN capabilities of SAGA GIS. </a></span><br />
<span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; white-space: pre-wrap;">People have already </span><a href="https://twitter.com/thematicmapping/status/773219394730295296" style="font-family: arial; white-space: pre-wrap;">helped on Twitter</a><span style="font-family: "arial"; white-space: pre-wrap;">, and I'll include some of these suggestions in this post. </span><br />
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
Help! Are there any good <a href="https://twitter.com/hashtag/opensource?src=hash">#opensource</a> solutions to turn a DEM into a TIN? <a href="https://twitter.com/hashtag/gistribe?src=hash">#gistribe</a> <a href="https://twitter.com/hashtag/foss4g?src=hash">#foss4g</a> <a href="https://twitter.com/hashtag/gis?src=hash">#gis</a> <a href="https://twitter.com/hashtag/3d?src=hash">#3d</a> <a href="https://twitter.com/hashtag/postgis?src=hash">#postgis</a> <a href="https://t.co/YWV59HtNgW">pic.twitter.com/YWV59HtNgW</a></div>
— Bjørn Sandvik (@thematicmapping) <a href="https://twitter.com/thematicmapping/status/773219394730295296">September 6, 2016</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
<span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span id="docs-internal-guid-5e373a9d-054a-ccfc-415d-87700a3a95f8"><span style="font-family: "arial"; vertical-align: baseline; white-space: pre-wrap;">My example DEM of Jotunheimen in Norway can be <a href="https://www.dropbox.com/s/qlnv4782us5gn5t/jotunheimen.tif?dl=0">downloaded here (144 MB GeoTIFF)</a>. This is the same dataset <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs-part-1.html">I've used previously</a> for my terrain <a href="http://blog.thematicmapping.org/2014/10/3d-terrains-with-cesium.html">mapping experiments with three.js and Cesium</a>. </span></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-OfMkxK-c74o/V9A2yz-ymfI/AAAAAAAAues/AEqcwoudOocOMOqn0qQiW8CPHwij-BbmACLcB/s1600/area.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://4.bp.blogspot.com/-OfMkxK-c74o/V9A2yz-ymfI/AAAAAAAAues/AEqcwoudOocOMOqn0qQiW8CPHwij-BbmACLcB/s400/area.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The goal now is to turn this raster DEM into a nice <a href="https://en.wikipedia.org/wiki/Triangulated_irregular_network">triangulated irregular network (TIN)</a> optimised for 3D rendering. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The dream solution would be a command line tool (part of GDAL?) that can turn a raster DEM into an optimised TIN.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="text-align: left;">
Open source candidates: </h3>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li><a href="http://blog.thematicmapping.org/2016/09/creating-tins-in-saga-gis.html">SAGA GIS</a></li>
<li>GRASS GIS</li>
<li>Blender</li>
<li>MeshLab</li>
<li>CGAL</li>
<li>PostGIS</li>
<li>CloudCompare</li>
<li>Point Cloud Library (PCL)</li>
<li><a href="https://github.com/anoved/phstl">phstl</a></li>
<li><a href="https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification">Fast-Quadric-Mesh-Simplification</a></li>
</ul>
<div>
<br /></div>
<div>
<h3 style="text-align: left;">
GIS StackExchange</h3>
<ul style="text-align: left;">
<li><a href="http://gis.stackexchange.com/questions/121561/generating-a-mesh-from-dtm">Generating a Mesh from DTM</a></li>
</ul>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
Commercial tools: </h3>
</div>
<div>
<ul style="text-align: left;">
<li><a href="http://www.esri.com/software/arcgis/extensions/3danalyst">ArcGIS 3D Analyst</a></li>
<li><a href="http://www.agi.com/products/stk/terrain-server/">STK Terrain Server</a></li>
</ul>
<div>
<br />
<br />
<br />
<br />
<br /></div>
</div>
</div>
Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-4741970181714760187.post-21392891275435836602016-08-21T15:33:00.002+01:002016-08-22T08:17:16.102+01:00The history of the Telemark Canal - projected on a physical landscape model<div dir="ltr" style="text-align: left;" trbidi="on">
Together with Jon Olav Eikenes and Christan Løverås, I'm part of a new startup called <a href="http://norviz.com/">Norviz</a>. The main focus so far has been on projecting animated graphics onto physical landscape models. Our first job was to tell the history of <a href="http://www.visittelemark.com/telemarkskanalen">the Telemark Canal</a>, a beautiful waterway connecting the sea and the interior through eight locks at a distance of 105 km from Skien to Dalen in Norway.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/LLrbNuDDiVE/0.jpg" frameborder="0" height="360" src="https://www.youtube.com/embed/LLrbNuDDiVE?feature=player_embedded&rel=0" width="640"></iframe></div>
<br />
The installation was made for <a href="http://en.vest-telemark.museum.no/">West Telemark museum</a>, and is now on show in <a href="http://www.visittelemark.com/telemarkskanalen/things-to-do/vrangfoss-sluser-p580943">Vrangfoss</a>, the largest lock complex on the canal with five locks and a lift of 23 metres. The 3D model displays a 10 minutes map animation showing the history of the canal together with historical images, voice and sound effects.<br />
<br />
Here are some of the technical details which might interest my readers :-)<br />
<br />
The digital elevation model was prepared in <a href="https://www.blender.org/">Blender</a> and cutted with a a <a href="https://en.wikipedia.org/wiki/CNC_router">CNC router</a>. It took the machine about 30 hours to finish the whole model.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-EdQsLoEtwCY/V7mpy10ECiI/AAAAAAAAuSE/qu3pd5Qilfo3kXv_ia9vtZ6xOIilrc6GgCLcB/s1600/20160514-IMG_9724.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="426" src="https://3.bp.blogspot.com/-EdQsLoEtwCY/V7mpy10ECiI/AAAAAAAAuSE/qu3pd5Qilfo3kXv_ia9vtZ6xOIilrc6GgCLcB/s640/20160514-IMG_9724.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cutting a large 240x110 cm model of the Telemark Canal in Valchromat. </td></tr>
</tbody></table>
Time-lapse of the cutting process:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/6xGtbDmFoWc/0.jpg" frameborder="0" height="360" src="https://www.youtube.com/embed/6xGtbDmFoWc?feature=player_embedded&rel=0" width="640"></iframe></div>
<br />
After two coats of white paint, our model became a nice canvas for our map animation. Fun to see the geological structures from above.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-XHN7pcKgyZc/V7mr2zHl8OI/AAAAAAAAuSQ/R742odtskYEUo4VfdAom5xRbKmGE5P2pwCLcB/s1600/20160607-IMG_1907.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="512" src="https://4.bp.blogspot.com/-XHN7pcKgyZc/V7mr2zHl8OI/AAAAAAAAuSQ/R742odtskYEUo4VfdAom5xRbKmGE5P2pwCLcB/s640/20160607-IMG_1907.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Setup and calibration in an old barn at Vrangfoss. The video projector was mounted 4 meters above the model. </td></tr>
</tbody></table>
The various maps telling the story of the canal was rendered with <a href="http://mapnik.org/">Mapnik</a> before adding transitions and special effects in Adobe After Effects. With the help of <a href="http://threejs.org/">three.js</a> and some homemade scripts, we were able to align our map animation with the uneven landscape surface. Lastly we used JavaScript for Automation (JSX) to link and synchronise the the different parts of the installation. <br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-FbJAyB1Fwlw/V7mr_QLyKNI/AAAAAAAAuSU/81qeqKEY0vcAspbwyNC6eSTrm4LkoosgwCLcB/s1600/Telemark_ovanfra%25CC%258A.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="536" src="https://4.bp.blogspot.com/-FbJAyB1Fwlw/V7mr_QLyKNI/AAAAAAAAuSU/81qeqKEY0vcAspbwyNC6eSTrm4LkoosgwCLcB/s640/Telemark_ovanfra%25CC%258A.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The final installation showing graphics projected on the physical landscape model. </td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-D344RduALto/V7niT6UfBoI/AAAAAAAAuSo/09bgGJPD390-yTx6gYw9fkGBFPuwrIGtACLcB/s1600/varden.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="556" src="https://1.bp.blogspot.com/-D344RduALto/V7niT6UfBoI/AAAAAAAAuSo/09bgGJPD390-yTx6gYw9fkGBFPuwrIGtACLcB/s640/varden.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">From <a href="http://www.varden.no/">Varden newspaper</a> 28 June 2016.</td></tr>
</tbody></table>
<br />
See it live at Vrangfoss during summer season while the canal boats are operating!<br />
<br />
Are you interested in collaborating with us or help us fill the world with engaging visualizations? <a href="http://norviz.com/">Please don’t hesitate contacting us</a>!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-vYp4p2RG0iI/V7qmRQ-CIJI/AAAAAAAAuTE/Navx8gwGazwt7gRl08yjQ_gpsw1Eo1LQQCLcB/s1600/norviz_black.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="115" src="https://1.bp.blogspot.com/-vYp4p2RG0iI/V7qmRQ-CIJI/AAAAAAAAuTE/Navx8gwGazwt7gRl08yjQ_gpsw1Eo1LQQCLcB/s320/norviz_black.png" width="320" /></a></div>
<br />
Map data from <a href="http://www.kartverket.no/en/Maps--Nautical-Charts/Gratis-kartdata/Open-and-Free-geospatial-data-from-Norway/">Kartverket</a>.<br />
Concept and story by <a href="http://indici.no/">Indici</a> and <a href="http://www.vest-telemark.museum.no/">West Telemark museum</a>.<br />
Photos above taken by Jon Olav Eikenes.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-43770995004146649972016-04-16T16:19:00.000+01:002016-04-17T11:30:08.213+01:00Finding your way with OpenStreetMap<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
OpenStreetMap is not only for streets, it also contains an impressive amount of hiking trails. I’m currently planning a a week’s hike in June, crossing the Alps from Oberstdorf to Vernago. How can I extract the route from OpenStreetMap and use it on my GPS?<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://3.bp.blogspot.com/-N34Px00yAMQ/VxJOI2WbPbI/AAAAAAAAt-Q/4rWopi-dmz02_4EquHPu6hZqLPM-1HOHACLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.35.54.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="476" src="https://3.bp.blogspot.com/-N34Px00yAMQ/VxJOI2WbPbI/AAAAAAAAt-Q/4rWopi-dmz02_4EquHPu6hZqLPM-1HOHACLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B16.35.54.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.8px;">The route visualised in CartoDB. <a href="https://turban.cartodb.com/viz/8b781bfc-03df-11e6-b264-0e674067d321/embed_map">Interactive version.</a></td></tr>
</tbody></table>
The <a href="http://extract.bbbike.org/">BBBike extract service</a> allows you to download OSM data for your region of choice.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-ho_5vMxZIBI/VxI5OC5a6qI/AAAAAAAAt80/MPpSG_kSiw8vt2qMgwUd7wXgGdoAhOCuACLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B14.55.18.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="322" src="https://3.bp.blogspot.com/-ho_5vMxZIBI/VxI5OC5a6qI/AAAAAAAAt80/MPpSG_kSiw8vt2qMgwUd7wXgGdoAhOCuACLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B14.55.18.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can select your area of interest by using the map interface, or by specifying the map bounds coordinates. </td></tr>
</tbody></table>
I selected an area covering the entire route, and ordered the data in a Shapefile format. Within a minute I received an email with a download link.<br />
<br />
The extract contains 8 shapefiles, and we only need the roads shapefile, which also contains hiking trails. If I open the shapefile in QGIS it looks like this:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-CItZ3zfDtrs/VxI7w19DBdI/AAAAAAAAt9A/BM19nj5b6foPvF_Akbsr6o2IGwOCOXI2wCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B15.18.09.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="442" src="https://2.bp.blogspot.com/-CItZ3zfDtrs/VxI7w19DBdI/AAAAAAAAt9A/BM19nj5b6foPvF_Akbsr6o2IGwOCOXI2wCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B15.18.09.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Roads and hiking trails in the Alps. </td></tr>
</tbody></table>
You'll have great difficulties finding your trail on this map, so let's add <a href="http://www.3liz.com/blog/rldhont/index.php?post/2012/07/17/OpenStreetMap-Tiles-in-QGIS">a basemap from OpenStreetMap</a>. Save this as an XML file on your computer:<br />
<br />
<script src="https://gist.github.com/turban/9276486a4946b64657ccfe1b3295a40a.js"></script>
</div>
<br />
Drag the file onto your QGIS dashboard. If you do this before loading the roads shapefile you'll make sure that they are displayed in the same projection, and that the roads and trails are shown on top:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-NUh42Nnpz54/VxI_Il0-bqI/AAAAAAAAt9M/kv_5wpzHeBwo7x1kAlU7gK7w694GYJyzwCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B15.32.58.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="454" src="https://2.bp.blogspot.com/-NUh42Nnpz54/VxI_Il0-bqI/AAAAAAAAt9M/kv_5wpzHeBwo7x1kAlU7gK7w694GYJyzwCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B15.32.58.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">OSM road network shown on top of OSM map tiles in QGIS.</td></tr>
</tbody></table>
It's still hard to distinguish hiking trails from roads, as they all look the same. We can easily change the style of hiking trails in the style editor:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-hgMYAY8qX54/VxJBhjNCPQI/AAAAAAAAt9U/DgFg5z9RAgIjqefrTZ8_a5PbNRDG9KiFgCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B15.42.54.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://4.bp.blogspot.com/-hgMYAY8qX54/VxJBhjNCPQI/AAAAAAAAt9U/DgFg5z9RAgIjqefrTZ8_a5PbNRDG9KiFgCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B15.42.54.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Select categorized style and give the path type an extra boost so it stands out on the map. </td></tr>
</tbody></table>
The paths are now easier to see:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-cYJwvp7-sew/VxJFs27OeQI/AAAAAAAAt9g/LXuXBycBxQk_88S1OuJHwhp60wxoOsC3wCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.00.59.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="448" src="https://1.bp.blogspot.com/-cYJwvp7-sew/VxJFs27OeQI/AAAAAAAAt9g/LXuXBycBxQk_88S1OuJHwhp60wxoOsC3wCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B16.00.59.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Paths marked in red.</td></tr>
</tbody></table>
Next we need to select the path we plan to follow. Use the "Select Features(s)" tool and click on the path segments you plan to follow.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-qQE7F_e9ckI/VxJGPHlnvpI/AAAAAAAAt9k/p1JGpmIaB4QOGpkouiunC6ojKQcETxIdQCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.03.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-qQE7F_e9ckI/VxJGPHlnvpI/AAAAAAAAt9k/p1JGpmIaB4QOGpkouiunC6ojKQcETxIdQCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.03.10.png" /></a></div>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-vg3lNy2w7J4/VxJHDeIEtMI/AAAAAAAAt9s/k5cXg8PEtCwpruahhb6PusuPLFS1RHqnwCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.06.46.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="479" src="https://3.bp.blogspot.com/-vg3lNy2w7J4/VxJHDeIEtMI/AAAAAAAAt9s/k5cXg8PEtCwpruahhb6PusuPLFS1RHqnwCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B16.06.46.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Select the path segments you plan to follow. </td></tr>
</tbody></table>
When you've marked your route, you can right click the roads layer and select "Save As...". Check that you only want to save selected features:<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-KqGsQTSlasM/VxJIZH2oy8I/AAAAAAAAt94/O0RAAAQnr4w95MgfuRsykoZk2-iS8Z18wCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.11.24.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://2.bp.blogspot.com/-KqGsQTSlasM/VxJIZH2oy8I/AAAAAAAAt94/O0RAAAQnr4w95MgfuRsykoZk2-iS8Z18wCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.11.24.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Save your track as a new shapefile.</td></tr>
</tbody></table>
It's best to have your route as a continuous line (or one for each day if you're on a long trek), and you can use the <a href="https://plugins.qgis.org/plugins/joinmultiplelines/">"Join multiple lines" plugin</a> in QGIS to achieve this. The plugin will also handle gaps in your route by drawing a direct line between them.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/--B1HNos4AuM/VxJKLkiR7qI/AAAAAAAAt-E/ThKO8hEoN-Qd7Sj2gnT4eOao05SLCelsACLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.20.08.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://3.bp.blogspot.com/--B1HNos4AuM/VxJKLkiR7qI/AAAAAAAAt-E/ThKO8hEoN-Qd7Sj2gnT4eOao05SLCelsACLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.20.08.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Just select the full path and click on "Join multiple lines". Save the results. </td></tr>
</tbody></table>
<br />
We now have a shapefile of our planned hiking route, thanks to OpenStreetMap, BBbike and QGIS.<br />
<br />
Next, I want to <a href="http://docs.cartodb.com/tutorials/import_shapefile_in_cartodb/">upload the shapefile to CartoDB</a> to create an <a href="https://turban.cartodb.com/viz/8b781bfc-03df-11e6-b264-0e674067d321/embed_map">interactive map showing of the route</a> (also shown as the first image above). You can also study the route on top of detailed aerial imagery from Bing on <a href="http://turban.no/alps-e5">my tracking site</a>:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-bCYuuDNkmuM/VxJPJc0Zz3I/AAAAAAAAt-Y/WiTahl3j4Us3MiGOPng_DJeIUcydCZVCgCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.41.00.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="408" src="https://2.bp.blogspot.com/-bCYuuDNkmuM/VxJPJc0Zz3I/AAAAAAAAt-Y/WiTahl3j4Us3MiGOPng_DJeIUcydCZVCgCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B16.41.00.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://turban.no/alps-e5">Interactive version</a> (click on "Route" in the top menu.</td></tr>
</tbody></table>
You can also save your track as a KML file in QGIS, and open it in Google Earth - a great way of getting a visual impression of the hike before you go.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-cHb3G_3DPFs/VxK2GfsZ-VI/AAAAAAAAt_M/-byng39TBdULTD0TP_ri95Ixw7XHvbG3wCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B23.59.43.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="425" src="https://1.bp.blogspot.com/-cHb3G_3DPFs/VxK2GfsZ-VI/AAAAAAAAt_M/-byng39TBdULTD0TP_ri95Ixw7XHvbG3wCLcB/s640/Screen%2BShot%2B2016-04-16%2Bat%2B23.59.43.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Planning your hike with Google Earth. </td></tr>
</tbody></table>
<br />
The last step is to upload the track to your GPS so you can use it for navigation. Open the track shapefile in QGIS, and save it in the GPX format.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-AVq0R35q2Xw/VxJRAusmB4I/AAAAAAAAt-k/O8pqKNHOSlA62kZUqBcw4voxj19tY3qGQCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.46.48.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://3.bp.blogspot.com/-AVq0R35q2Xw/VxJRAusmB4I/AAAAAAAAt-k/O8pqKNHOSlA62kZUqBcw4voxj19tY3qGQCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B16.46.48.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Right click the track layer and select "Save As..."</td></tr>
</tbody></table>
<br />
I then use Garmin Basecamp to transfer the route to my GPS:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-8G104x1DFRs/VxJVzi9wg1I/AAAAAAAAt-0/RyGjJMd9jWovZb0NYMwBztW2TKacL8T3gCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B17.08.25.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://3.bp.blogspot.com/-8G104x1DFRs/VxJVzi9wg1I/AAAAAAAAt-0/RyGjJMd9jWovZb0NYMwBztW2TKacL8T3gCLcB/s1600/Screen%2BShot%2B2016-04-16%2Bat%2B17.08.25.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Transfer the route to your GPS device.</td></tr>
</tbody></table>
Then we're ready for takeoff!</div>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4741970181714760187.post-75950260357528476842015-12-26T15:13:00.002+00:002017-01-28T16:33:38.912+00:00Mapping a real time snow cover<div dir="ltr" style="text-align: left;" trbidi="on">
Norway is a country with huge climate variations between seasons, lowlands and mountains, coastal areas and inland, and between north and south. In the recent years, we have also seen more extreme weather and greater fluctuations in temperature and snow cover. At the same moment of time there might be meters of snow in the mountains, while the trees are blooming by the fjord a few kilometers away. Outdoor activities are popular among citizens and tourists alike, and in Norway you can do typical summer and winter activities all year around. The goal of this blog post is to create a near real time map of the snow cover, where the snow blends into the landscape.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-_u8E8lwcAK8/Vn6tVdSJ5tI/AAAAAAAAs14/FI6dXNWtXBk/s1600/jotunheimen-map.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://3.bp.blogspot.com/-_u8E8lwcAK8/Vn6tVdSJ5tI/AAAAAAAAs14/FI6dXNWtXBk/s640/jotunheimen-map.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The snow map of Jountunheimen we're going to create.</td></tr>
</tbody></table>
<br />
As shown on this blog, I like to create maps and 3D visualisations using a wide range of open source tools, combined with various programming techniques. This snow mapping experiment is no exception. Open Source allows me to mix and match the tools and techniques I need, and doing this programmatically has the added benefit of automation. When the full map making process is defined, we can easily run it for various areas and terrains. It was an important goal of this project to keep the snow cover up-to-date on a daily basis.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-nYJzuhRIg2w/Vn6xKzh34xI/AAAAAAAAs2M/6wl-7oCzq0Y/s1600/Screen%2BShot%2B2015-12-26%2Bat%2B16.23.37.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="360" src="https://4.bp.blogspot.com/-nYJzuhRIg2w/Vn6xKzh34xI/AAAAAAAAs2M/6wl-7oCzq0Y/s640/Screen%2BShot%2B2015-12-26%2Bat%2B16.23.37.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Crosscountry skiing in Jotunheimen national park. Photo: Bjørn Sandvik</td></tr>
</tbody></table>
Geospatial datasets can be very large, and we often have to divide the data into chunks to be able to run calculations. I have <a href="https://github.com/MasterMaps/norway-50k-grid">divided mainland Norway into 218 cells</a>, each covering an area of 50 x 50 km. With datasets at 10 meters resolution, all tools presented below were capable of processing the data.<br />
<br />
The Norwegian Mapping Authority <a href="http://data.kartverket.no/">released its topographic datasets</a> in 2013. This included an <a href="http://data.kartverket.no/download/content/geodataprodukter?korttype=3595">elevation model of mainland Norway at 10 m resolution</a>. The <a href="http://www.nve.no/en/">Norwegian Water Resources and Energy Directorate (NVE) </a>is monitoring the country's water resources, and they provide data of snow gain, snow melt and snow depth. As my map is aimed towards cross-country skiers, I’m using a <a href="http://www.nve.no/Global/senorge/weatherandsnowdata_no.pdf">dataset showing areas with a skiing surface</a>, based on interpolated weather observations.<br />
<br />
<b>Elevation data</b><br />
The 10 m digital elevation model (DEM) from the Norwegian Mapping Authority was used to blend the snow into the landscape. A few GDAL commands allowed me to create a 50 x 50 km DEM from the nationwide DEM, and to translate it into the various formats supported by the tools in use.<br />
<br />
The 10 m elevation model contains too much detail to represent a snow cover. I could downsample the dataset, but that would blur out important terrain features like mountain ridges and valley edges. <a href="http://terraincartography.com/terrainsculptor/">Terrain Sculptor</a> came to the rescue. It is a tool by Bernhard Jenny and Anna Leonowicz to <a href="http://cartography.oregonstate.edu/pdf/2010_Leonowicz_Terrain_Sculptor_Generalizing_Terrain_Models_for_Relief_Shading.pdf">generalize terrain models for relief shading</a>. It removes unnecessary and distracting terrain details, and better resembles a smooth snow covered landscape. Unfortunately, Terrain Sculptor can only be used with a graphical interface, and not as a command line tool, so it can not be used in an automatic process. I used it to create a generalised terrain model for the 50 x 50 km area of Jotunheimen and Tyin.<br />
<br />
The generalised elevation model was used to create a shaded relief. We can easily <a href="http://blog.thematicmapping.org/2012/06/creating-hillshades-with-gdaldem.html">create a grayscale hillshade with GDAL</a>, but the snow required some tints to look better. I created a continuous colour scale from blue shadows to white with a touch of yellow, and turned the grayscale hillshade into a tinted hillshade. For areas without snow, I used the same elevation data to create a color relief progressing from green for lower elevations up through yellows/browns, and on to grays and white at the highest elevations.<br />
<br />
Finally, the elevation model was used to calculate steep terrain (slope) where there will be less snow. The steep terrain will be subtracted from the snow surface to improve the view in alpine areas. This was achieved in <a href="https://github.com/MasterMaps/snowmap/blob/master/tile.js">a series of steps</a>: A slope surface was calculated from the DEM, and then areas steeper than 50 degrees were extracted and vectorised. The process of vectorising raster data is described below.<br />
<br />
<b>Snow cover</b><br />
The skiing surface dataset from the Norwegian Water Resources and Energy Directorate (NVE) <a href="http://www.senorge.no/?p=senorgeny&m=bmNVEGrey%3BMapLayer_ski%3B&l=en">is available from a public Web Map Service (WMS)</a> with a 1 km resolution. The dataset is updated 8 times a day. The original WMS image includes 4 colours: Blue represents skiing surface with dry snow, violet is surface with wet snow, yellow is areas with little snow, and green is areas without snow. As the map is targeted towards cross country skiers, the dry (blue) and wet (violet) snow are combined into one layer. The areas with little snow (yellow) are not included in this map, but could be used to create a more gradual shift between snow cover and bare ground.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-zNTz-e5AKTw/Vn6tBV4F-LI/AAAAAAAAs1k/u9SJ3J2PYIY/s1600/snow-surface-1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://2.bp.blogspot.com/-zNTz-e5AKTw/Vn6tBV4F-LI/AAAAAAAAs1k/u9SJ3J2PYIY/s640/snow-surface-1.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The original WMS image of skiing conditons.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-KJOcl2eWdkU/Vn6tBRiwvBI/AAAAAAAAs1g/okFY5FQR8EE/s1600/snow-surface-2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://3.bp.blogspot.com/-KJOcl2eWdkU/Vn6tBRiwvBI/AAAAAAAAs1g/okFY5FQR8EE/s640/snow-surface-2.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Wet at dry skiing conditions combined. Each square is 1 x 1 km. </td></tr>
</tbody></table>
<br />
To avoid the pixelated appearance of the snow surface, the image is vectorised into smooth scalable snow polygons. This was achieved using <a href="http://potrace.sourceforge.net/">Potrace</a> by Peter Selinger, an open source tool for tracing bitmaps. Potrace transforms the the blocky WMS image into smooth vectors. It supports GeoJSON output, which makes it easier to use in geographic applications. A problem with this technique is that the smooth polygons seem more accurate than they are. There are other, and probably better, ways to interpolate the data, as following height contours in the area.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-cI885E-70BQ/Vn6tHReadxI/AAAAAAAAs1w/P3SyXF2ruT0/s1600/snow-surface-3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://1.bp.blogspot.com/-cI885E-70BQ/Vn6tHReadxI/AAAAAAAAs1w/P3SyXF2ruT0/s640/snow-surface-3.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Vectorised image from Potrace.</td></tr>
</tbody></table>
<br />
With all the map layers in place, <a href="http://mapnik.org/">Mapnik</a> was used to generate the map shown below. Mapnik is an open source toolkit to generate beautiful maps from different vector and raster sources. The order and styles are expressed in an XML document, and then applied to the data. First, colour relief, lakes, snow polygons, steep terrain, glacier polygons and road lines are added in turn. Then all the layers are blended with the hillshade, before adding buildings and a thin lake outline as a final touch.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-h7XwnLOkjNk/Vn6thIg6NoI/AAAAAAAAs2A/eS1L6Heq2m8/s1600/3d.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="480" src="https://3.bp.blogspot.com/-h7XwnLOkjNk/Vn6thIg6NoI/AAAAAAAAs2A/eS1L6Heq2m8/s640/3d.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Jotunheimen and Tyin covered with a snow cover obtained from the Norwegian Water Resources and Energy Directorate on. The map image is applied to a 3D model using elevation data from the Norwegian Mapping Authority.</td></tr>
</tbody></table>
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-73024605060161713132015-11-06T17:23:00.006+00:002015-11-07T08:58:15.349+00:00Mapping grid-based statistics using OpenLayers, Three.js and D3.js<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
I've just finalised two tutorials on mapping grid-based statistics. The tutorials are in Norwegian, but the source code is available in English, and should be easy to follow.<br />
<br />
<h3 style="text-align: left;">
Tutorial 1: "Grid-based population data"<br /><div style="text-align: left;">
</div>
</h3>
<div style="text-align: left;">
Mapping grid-based population data of Oslo, Norway, using <a href="http://openlayers.org/">OpenLayers 3</a> and <a href="http://d3js.org/">D3.js</a>. The user can select an area to see the number of inhabitants.<br />
<br /></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Rqr4TVrmkwg/Vjzcrz-ZAzI/AAAAAAAAsls/yLJMTEzflE4/s1600/oslopop.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-Rqr4TVrmkwg/Vjzcrz-ZAzI/AAAAAAAAsls/yLJMTEzflE4/s640/oslopop.gif" width="640" /></a></div>
<br />
<a href="https://github.com/GeoForum/veiledning08">Tutorial</a> | <a href="http://geoforum.github.io/veiledning08/">Demo</a> | <a href="https://github.com/GeoForum/veiledning08/blob/gh-pages/js/map.js">Source</a><br />
<br />
<h3 style="text-align: left;">
Tutorial 2: "Grid-based statistics in 3D"</h3>
<div style="text-align: left;">
3D visualisation of grid-based population data of Oslo, Norway, using <a href="http://threejs.org/">Three.js</a> and <a href="http://d3js.org/">D3.js</a>.<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-01n8u4ZzROw/Vjzc_uByaEI/AAAAAAAAsl0/8px4xQ4PvLQ/s1600/oslo3d.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="407" src="http://2.bp.blogspot.com/-01n8u4ZzROw/Vjzc_uByaEI/AAAAAAAAsl0/8px4xQ4PvLQ/s640/oslo3d.gif" width="640" /></a></div>
<br />
<a href="https://github.com/GeoForum/veiledning09">Tutorial</a> | <a href="http://geoforum.github.io/veiledning09/">Demo</a> | <a href="https://github.com/GeoForum/veiledning09/blob/gh-pages/js/map.js">Source</a><br />
<br />
The basemap is from the <a href="http://kartverket.no/en/">Norwegian Mapping Authority</a>, and the grid-based population data from <a href="http://www.ssb.no/en/">Statistics Norway</a>.<br />
<br />
The tutorials are provided by <i><a href="http://www.geoforum.no/om-geforum/prosjekt-innovasjon/">Project Innovation</a></i> from <a href="http://www.geoforum.no/">GeoForum</a>, a Norwegian non-profit industry organization for individuals and companies/agencies working in mapping, surveying and geographic information.<br />
<br />
Please <a href="mailto:bjorn@mastermaps.com">notify me</a> if you use these techniques in your own projects! </div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-4741970181714760187.post-15235908177003233202015-10-14T15:02:00.000+01:002015-10-15T08:44:17.527+01:00Mapping the Arctic sea ice<div dir="ltr" style="text-align: left;" trbidi="on">
There as been a lot of attention about the diminishing Arctic sea ice in recent years. We’re often exposed to images showing the extremes. My goal was to show the changing sea ice <a href="http://mastermaps.com/arctic/seaice/monthly/">month by month</a>, and even <a href="http://mastermaps.com/arctic/seaice/daily/">day by day</a>. Sea ice is a critical component of our planet because of its influence on the global climate.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-Ht5yVg6dUIk/Vh4xNomMimI/AAAAAAAAseA/XkElHnBgveU/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B12.39.19.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="http://1.bp.blogspot.com/-Ht5yVg6dUIk/Vh4xNomMimI/AAAAAAAAseA/XkElHnBgveU/s640/Screen%2BShot%2B2015-10-14%2Bat%2B12.39.19.png" width="638" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The sea ice cover in the Arctic in September 2015. The black line is the median extent (1981-2010) for this month. <a href="http://mastermaps.com/arctic/seaice/monthly/">See interactive version</a>.</td></tr>
</tbody></table>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-SibapUozVuE/Vh4xNkPMVzI/AAAAAAAAsd8/j6b_4-BVGTI/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B12.40.00.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-SibapUozVuE/Vh4xNkPMVzI/AAAAAAAAsd8/j6b_4-BVGTI/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B12.40.00.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The graph shows the change in sea ice cover for September since 1979, in percent from the mean extent (1981-2010). September 2015 had the fourth lowest extent in the satellite record. <a href="http://mastermaps.com/arctic/seaice/monthly/">See interactive version</a>.</td></tr>
</tbody></table>
<br />
The <a href="http://nsidc.org/">National Snow and Ice Data Center</a> (NSIDC) provides two great datasets collected by satellite of the Arctic Sea Ice:<br />
<br />
<b><a href="https://nsidc.org/data/seaice_index/">Sea Ice Index</a></b><br />
You get the longest time-series using Sea Ice Index, which dates back to November 1978. The dataset is available at 25 km resolution. The images and data are produced in a consistent way making it appropriate for use when looking at long-term trends in sea ice cover.<br />
<br />
<a href="https://nsidc.org/data/masie/"><b>MASIE</b></a><br />
MASIE is a newer dataset at 4 km resolution, which dates back to 2006. Recently they also made the dataset available at 1 km resolution (back to December 2014), which is great for regional maps. Use MASIE when you want the most accurate view possible of Arctic-wide ice on a given day.<br />
<br />
<a href="http://nsidc.org/data/masie/masie_faq.html">This page</a> further explains the difference between the two datasets.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-uA1RYhLZX-w/Vh5fCnCIfpI/AAAAAAAAsfA/SZYa3L_mU2w/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B15.55.02.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="394" src="http://1.bp.blogspot.com/-uA1RYhLZX-w/Vh5fCnCIfpI/AAAAAAAAsfA/SZYa3L_mU2w/s640/Screen%2BShot%2B2015-10-14%2Bat%2B15.55.02.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">Responsive map layout adapting to various devices. Image from </span><a href="http://ami.responsivedesign.is/" style="font-size: 12.8px;">Am I Responsive</a><span style="font-size: 12.8px;">.</span></td></tr>
</tbody></table>
<br />
Polar maps are hard to make with popular mapping tools like <a href="https://www.mapbox.com/">Mapbox</a> and <a href="https://cartodb.com/">CartoDB</a>. I love these tools, and I use them a lot when the Mercator projection makes sense. But Mercator is a terrible match for polar data. Not only are the areas towards the poles greatly distorted, the world above 85°N or below 85°S simply don’t exist! While waiting for better projection support in these tools, you can try these hacks: <a href="https://www.mapbox.com/blog/mapping-arctic-ice-polar-projection/">Mapbox example</a>, <a href="http://javisantana.com/2015/01/21/non-mercator-tiles.html">CartoDB example</a>.<br />
<br />
We should always pick the right tools for our job. For this project I ended with a geohipster stack of <a href="http://d3js.org/">D3.js</a>, <a href="http://www.gdal.org/">GDAL</a> and <a href="https://nodejs.org/">Node.js</a> on <a href="https://www.digitalocean.com/">Digital Ocean</a> droplet. There is also a touch of <a href="https://cartodb.com/">CartoDB</a> to store some tabular ice extent data, but no geodata this time.<br />
<br />
D3 has <a href="https://github.com/mbostock/d3/wiki/Geo-Projections">great support</a> for different map projections. I decided to use the same <a href="https://nsidc.org/data/polar_stereo/ps_grids.html">polar stereographic projection</a> as the original sea ice datasets. This made it easier to keep the original resolution of the sea ice datasets. The only thing I did was to rotate the map to get Norway and Europe in the center - sorry to my North American readers ;-)<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-2u0u1N3VF6k/Vh5JLdjGHAI/AAAAAAAAseg/tOaijhCggZU/s1600/comparision.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="310" src="http://4.bp.blogspot.com/-2u0u1N3VF6k/Vh5JLdjGHAI/AAAAAAAAseg/tOaijhCggZU/s640/comparision.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sea ice maxiumum (March) and minimum (September) in 2015. <a href="http://mastermaps.com/arctic/seaice/daily/">See interactive version</a>. </td></tr>
</tbody></table>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-fkYc4JYw-5s/Vh5JUOY0j2I/AAAAAAAAseo/txN5OoXHTr0/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B14.17.17.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-fkYc4JYw-5s/Vh5JUOY0j2I/AAAAAAAAseo/txN5OoXHTr0/s1600/Screen%2BShot%2B2015-10-14%2Bat%2B14.17.17.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">There is a significant yearly cycle in sea ice cover, usually reaching a maximum in March, and a minimum in September. <a href="http://mastermaps.com/arctic/seaice/daily/">See interactive version</a>.</td></tr>
</tbody></table>
<br />
Bonus information for the map geeks: The polar projection of MASIE and Sea Ice Index is not exactly the same - not only is the central meridian different (-80° vs -45°), the latitude of true scale is 60° for MASIE and 70° for Sea Ice Index. The first discrepancy is just a matter of rotating the images until they overlap. To fix the latter you have to alter one of the projections to allow them to line up.<br />
<br />
I wanted my map to be up-to-date with the latest sea ice data available. I don’t have time to update the map every day - so I needed to do this in an automatic process. It was achieved by periodically checking for new data on the NSIDC servers, download the files and convert them to a web friendly format. The original GeoTIFF showing the sea ice extent on October 12 is 1.7 MB, while the compressed PNG shown on the map is just 12 KB, with the same 4 km resolution!<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-HQJXB4Ophfg/Vh43m6IcPsI/AAAAAAAAseQ/uce8GUhS_Xo/s1600/out2.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://2.bp.blogspot.com/-HQJXB4Ophfg/Vh43m6IcPsI/AAAAAAAAseQ/uce8GUhS_Xo/s400/out2.gif" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Animated GIF showing the changing sea ice extent from maxium in March 2015 to minimum in September. The animation is recorded directly from <a href="http://mastermaps.com/arctic/seaice/daily/">the website</a>, showing the benefit of the highly compressed PNGs from an SSD cloud server. </td></tr>
</tbody></table>
<br />
D3.js and SVG are a great match for responsive map layouts adapting to various screen sizes and resolutions. I wanted this map to be both mobile friendly and big screen friendly, and it was achieved using CSS3 <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes">flexbox</a> and <a href="http://tutorialzine.com/2015/05/simplify-your-stylesheets-with-the-magical-css-viewport-units/">viewport units</a>. <br />
<br />
<span id="docs-internal-guid-d9c03696-6659-71bc-6f4f-6f0714bda1a1"><span style="font-family: Arial; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Please <a href="http://mastermaps.com/">contact me</a> if you’re interested in using this visualisation, or if you would like help on another mapping project. </span></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-36668789207039779462015-06-04T19:40:00.001+01:002015-10-01T23:58:44.861+01:00Master maps<div dir="ltr" style="text-align: left;" trbidi="on">
I’m going freelance over the summer, after 5 great years at <a href="http://www.nrk.no/about/">the Norwegian Broadcasting Corporation (NRK)</a>. It was not an easy decision, but I have to try. I’ll tell more about my plans later. <a href="http://eepurl.com/bt-Eyv">Please sign up</a> to get notified about my services.<br />
<br />
Some of the projects I've been working on at NRK:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-FIKn8qJMW1U/VXCYjuJzDQI/AAAAAAAAdrk/C_9h_RRypjE/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B20.47.39.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="482" src="http://1.bp.blogspot.com/-FIKn8qJMW1U/VXCYjuJzDQI/AAAAAAAAdrk/C_9h_RRypjE/s640/Screen%2BShot%2B2015-06-03%2Bat%2B20.47.39.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The flexible mapping stack of NRK.no, allowing journalists and digital storytellers to create advanced maps in minutes. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-Tm46Yi56uXk/VXCY6784FeI/AAAAAAAAdus/G84rGkRO6AI/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B21.13.32.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="516" src="http://4.bp.blogspot.com/-Tm46Yi56uXk/VXCY6784FeI/AAAAAAAAdus/G84rGkRO6AI/s640/Screen%2BShot%2B2015-06-03%2Bat%2B21.13.32.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">"Kartoteket" - our in-house mapping tool built on top of our mapping stack.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-0sFVrUefkPA/VXCZDCKJy6I/AAAAAAAAdv8/5c89HhiHE6M/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B21.01.13.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://3.bp.blogspot.com/-0sFVrUefkPA/VXCZDCKJy6I/AAAAAAAAdv8/5c89HhiHE6M/s640/Screen%2BShot%2B2015-06-03%2Bat%2B21.01.13.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.nrk.no/fordypning/invasjonen-av-norge-i-1940-1.12245484?fullscreen">Digital storytelling</a> using NRKs mapping stack and Mapbox. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-APQoiZCKd_g/VYL_mQpM_8I/AAAAAAAArIg/wbOuqv9-R4E/s1600/aardal.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="376" src="http://4.bp.blogspot.com/-APQoiZCKd_g/VYL_mQpM_8I/AAAAAAAArIg/wbOuqv9-R4E/s640/aardal.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.nrk.no/norge/tidslinje-for-trippeldrapet-i-ardal-1.12413986?fullscreen" style="font-size: 12.8000001907349px;">Digital storytelling</a><span style="font-size: 12.8000001907349px;"> using NRKs mapping stack and Mapbox. </span></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-bapwDAqZabs/VXCZImmNF3I/AAAAAAAAdww/exn0XxE9smE/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B21.06.59.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="414" src="http://4.bp.blogspot.com/-bapwDAqZabs/VXCZImmNF3I/AAAAAAAAdww/exn0XxE9smE/s640/Screen%2BShot%2B2015-06-03%2Bat%2B21.06.59.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.nrk.no/norge/slik-vil-mjosbyene-rammes-1.11741510">Flood maps</a> using NRKs mapping stack and CartoDB.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-iKiKc80IK-I/VY0Ff_4z25I/AAAAAAAArOQ/hkc9shPEYw0/s1600/Screen%2BShot%2B2015-06-26%2Bat%2B09.50.10.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="370" src="http://1.bp.blogspot.com/-iKiKc80IK-I/VY0Ff_4z25I/AAAAAAAArOQ/hkc9shPEYw0/s640/Screen%2BShot%2B2015-06-26%2Bat%2B09.50.10.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.nrk.no/fordypning/mange-norske-bolighus-i-omrader-med-hoy-radonfare-1.12425861">Radon affected areas in Norway</a> using NRKs mapping stack.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-VtIzFPyubY0/VXCZRtcMwdI/AAAAAAAAdyI/BFBcnf8JTHA/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B20.53.08.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="478" src="http://4.bp.blogspot.com/-VtIzFPyubY0/VXCZRtcMwdI/AAAAAAAAdyI/BFBcnf8JTHA/s640/Screen%2BShot%2B2015-06-03%2Bat%2B20.53.08.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Our popular <a href="http://artikkel.ut.no/slik-far-du-vist-fram-turbildene-dine-pa-ut.no_-1.11755354">photo maps</a>. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-FGIu0aQL894/VXCZW5TN5gI/AAAAAAAAdy8/IpfBUi_ZrPY/s1600/Screen%2BShot%2B2015-06-03%2Bat%2B20.41.57.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="534" src="http://4.bp.blogspot.com/-FGIu0aQL894/VXCZW5TN5gI/AAAAAAAAdy8/IpfBUi_ZrPY/s640/Screen%2BShot%2B2015-06-03%2Bat%2B20.41.57.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://snutt.nrk.no/kart_apps/api/dist/?id=norge-rundt">Video map</a> of the long running TV show Norge Rundt.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-vymZTao7xFY/VYsBd7pK7PI/AAAAAAAArKY/oTO1xLqk1mA/s1600/Screen%2BShot%2B2015-06-24%2Bat%2B21.12.42.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="440" src="http://2.bp.blogspot.com/-vymZTao7xFY/VYsBd7pK7PI/AAAAAAAArKY/oTO1xLqk1mA/s640/Screen%2BShot%2B2015-06-24%2Bat%2B21.12.42.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Tracking of "<a href="http://www.nrk.no/sommer/">Sommerbåten</a>" along the coast of Norway.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-Ut2OlrzVUUM/VXqVEEGoyJI/AAAAAAAArBg/rIDCLzFgGhw/s1600/Work.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://4.bp.blogspot.com/-Ut2OlrzVUUM/VXqVEEGoyJI/AAAAAAAArBg/rIDCLzFgGhw/s640/Work.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Other work.</td></tr>
</tbody></table>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-15235903855805677582015-04-23T16:58:00.000+01:002015-04-23T17:17:02.465+01:00Real time satellite tracking of your journeys - how does it work? <div dir="ltr" style="text-align: left;" trbidi="on">
I'm back in Oslo after my <a href="http://blog.thematicmapping.org/2015/03/nordryggen-on-skis-for-25-days-creating_20.html">25 days ski trip across Nordryggen in Norway</a>. It was a great journey, and I would highly recommend doing all or parts of it if you enjoy cross-country skiing. Just be prepared for shifting weather conditions.<br />
<blockquote class="twitter-tweet" data-conversation="none" lang="en">
<a href="https://twitter.com/thematicmapping">@thematicmapping</a> <a href="https://twitter.com/mapperz">@mapperz</a> I thought “cross country” skiing meant ski across the countryside, but you have literally crossed a whole country!<br />
— harry_wood (@harry_wood) <a href="https://twitter.com/harry_wood/status/590199576209981440">April 20, 2015</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
The goal of the trip was also to test my solution for real time satellite tracking, explained in several of <a href="http://blog.thematicmapping.org/">my previous blog posts</a>. It worked out really well, and people were able to follow along in the comfort of their sofa.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-oQjFQT5UcjU/VTkRPOGqn9I/AAAAAAAAQMU/B6XWY_LZHrg/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B17.33.36.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-oQjFQT5UcjU/VTkRPOGqn9I/AAAAAAAAQMU/B6XWY_LZHrg/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B17.33.36.png" height="470" width="640" /></a></div>
<br />
I fastened a <a href="http://www.findmespot.eu/en/">Spot Satellite Messenger</a> to the top of my backpack, and left the device in tracking mode while skiing. The device sent my current position every 5 minutes, allowing me to update <a href="http://turban.no/nordryggen">the map</a> without any mobile coverage. When we arrived at a mountain hut, I pressed the OK button to set up a bed. I also programmed a button to show a snow cave, in case we wouldn't reach a hut. Luckily we didn't have to use it :-)<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-za4ICcK2ll4/VTkDB-sRN7I/AAAAAAAAQKk/QcjH9p5TXSs/s1600/nordryggen.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-za4ICcK2ll4/VTkDB-sRN7I/AAAAAAAAQKk/QcjH9p5TXSs/s1600/nordryggen.png" height="640" width="636" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://turban.no/nordryggen">My map and elevation plot</a> of the 25 days ski trip across Nordryggen. Most of the trip is above tree line, and there are only 5 road crossings in total. </td></tr>
</tbody></table>
<br />
The SPOT messenger only sends my time and position, so I had to create a web service to retrieve extra information about each location. I'm using <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">a service from the Norwegian Mapping Authority</a><br />
to retrieve the altitude, nearest place name and the terrain type. Earlier this winter, I experienced that the service did't return any altitude if I was skiing on lakes, so I'm using the <a href="https://developers.google.com/maps/documentation/elevation/">Google Elevation API</a> to avoid gaps in the elevation profile.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-SaLbNI-VoXg/VTkFCN5aO0I/AAAAAAAAQK4/9-69NERedVg/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B16.42.38.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-SaLbNI-VoXg/VTkFCN5aO0I/AAAAAAAAQK4/9-69NERedVg/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B16.42.38.png" height="400" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">By knowing the time and location, I could create an automatic service to obtain more information to enrich the map. In addition to elevation and place name, I've <a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">added a weather report</a>. The image show Bjordalsbu, the highest lying hut on the route 1586 m, which we visited in a strong breeze. </td></tr>
</tbody></table>
<br />
While skiing, I used <a href="http://blog.thematicmapping.org/2014/06/syncing-your-instagram-photos-to-cartodb.html">Instagram to post photos</a> that would instantly show on the map as well. This required mobile coverage, which is sparse in the mountains. After the trip, I <a href="http://blog.thematicmapping.org/2014/08/geotagging-photos-using-gps-tracks.html">synced my camera photos with my GPS track</a> to be able to show them along the route.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-0vl95fEhpkA/VTkD0qVZnuI/AAAAAAAAQKs/ojSovLdqwM0/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B16.36.59.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-0vl95fEhpkA/VTkD0qVZnuI/AAAAAAAAQKs/ojSovLdqwM0/s1600/Screen%2BShot%2B2015-04-23%2Bat%2B16.36.59.png" height="400" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Click "Bilder" in the top menu to see the photos along the route. </td></tr>
</tbody></table>
<br />
A few of my photos:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-lchwRD7N274/VTkGlqDEdAI/AAAAAAAAQLE/oBT1iZftiz0/s1600/DSC06926.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-lchwRD7N274/VTkGlqDEdAI/AAAAAAAAQLE/oBT1iZftiz0/s1600/DSC06926.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Eidsbugarden in Jotunheimen. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-ZNU4WAQdPRM/VTkGmHznQ8I/AAAAAAAAQLI/cWcUopHVB6A/s1600/DSC07107.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-ZNU4WAQdPRM/VTkGmHznQ8I/AAAAAAAAQLI/cWcUopHVB6A/s1600/DSC07107.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Iungsdalshytta in Skarveimen. </td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-PFzA1Odl7eY/VTkGniMTcdI/AAAAAAAAQLg/BTLLQcyPfig/s1600/DSC07508.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-PFzA1Odl7eY/VTkGniMTcdI/AAAAAAAAQLg/BTLLQcyPfig/s1600/DSC07508.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Taumevatn in Ryfylkeheiane.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-CoKqHt_RB0I/VTkGn0IJMEI/AAAAAAAAQLk/RuoLhTo1Zho/s1600/DSC07576.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-CoKqHt_RB0I/VTkGn0IJMEI/AAAAAAAAQLk/RuoLhTo1Zho/s1600/DSC07576.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Gaukhei in Setesdalsheiane. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-pmPu9CL2qfs/VTkGo0qEm_I/AAAAAAAAQLw/S5WqqE3oUcg/s1600/DSC07589.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-pmPu9CL2qfs/VTkGo0qEm_I/AAAAAAAAQLw/S5WqqE3oUcg/s1600/DSC07589.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">End of trip - and the snow - in Ljosland. </td></tr>
</tbody></table>
More photos in <a href="http://goo.gl/HAvDIA">my Google+ album</a>.</div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-4741970181714760187.post-58918818490173172672015-03-20T23:29:00.000+00:002015-03-22T16:23:41.748+00:00Transferring a route from QGIS to your GPS<div dir="ltr" style="text-align: left;" trbidi="on">
In <a href="http://blog.thematicmapping.org/2015/03/nordryggen-on-skis-for-25-days-creating_20.html">my last blog post</a>, we created a created a 500 km continuous line representing a ski route across Nordryggen in Norway. I need to transfer this route to my Garmin GPS so I can use it for navigation while skiing. How can it be done?<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-AhlQMD_m1fo/VQysv7DPkCI/AAAAAAAAPoA/nwfCTIwvaxY/s1600/omsbreen.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-AhlQMD_m1fo/VQysv7DPkCI/AAAAAAAAPoA/nwfCTIwvaxY/s1600/omsbreen.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cross-country skiing in Skarvheimen, Norway. Photo: Bjørn Sandvik</td></tr>
</tbody></table>
<br />
Open the route in <a href="http://www.qgis.org/">QGIS</a>, right click the layer and select "Save As...". Select "<a href="http://en.wikipedia.org/wiki/GPS_Exchange_Format">GPS eXchange Format [GPX]</a>" as the format, and "WGS 84" as the coordinate reference system (CRS). I'm also skipping attribute creation as my line only contains coordinates.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-PsuayChhZVI/VQygzVzt45I/AAAAAAAAPnc/CIt8tw_WcGo/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B22.19.30.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-PsuayChhZVI/VQygzVzt45I/AAAAAAAAPnc/CIt8tw_WcGo/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B22.19.30.png" /></a></div>
<br />
<br />
QGIS saves the line as a GPX route. You can import this route in <a href="http://www.garmin.com/en-GB/shop/downloads/basecamp">Garmin BaseCamp</a> (File -> Import). Give the track a meaningful name.<br />
<br />
My 500 km route consists of 3867 points, but most Garmin GPS units are <a href="https://support.garmin.com/support/searchSupport/case.faces?caseId=%7B0b02f820-03db-11e0-e050-000000000000%7D">only capable of showing 250 points</a> per route. You can get around this limitation by converting the <a href="https://support.garmin.com/support/searchSupport/case.faces?caseId=%7B67ef9980-50c4-11dc-4ec8-000000000000%7D">route into a track</a>. Right-click the route in Basecamp and select "Create Track from Route". <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-i44K03Z0Eyw/VQyoV_75BiI/AAAAAAAAPns/nvS0FGu0qAo/s1600/Screen%2BShot%2B2015-03-21%2Bat%2B00.01.19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-i44K03Z0Eyw/VQyoV_75BiI/AAAAAAAAPns/nvS0FGu0qAo/s1600/Screen%2BShot%2B2015-03-21%2Bat%2B00.01.19.png" /></a></div>
<br />
Transfer <a href="https://raw.githubusercontent.com/turban/nordryggen/gh-pages/data/track.gpx">the track</a> to your GPS unit:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-k-A_Bfq1vDQ/VQyozyXt17I/AAAAAAAAPn0/4fniBn-ZVkY/s1600/Screen%2BShot%2B2015-03-21%2Bat%2B00.08.57.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-k-A_Bfq1vDQ/VQyozyXt17I/AAAAAAAAPn0/4fniBn-ZVkY/s1600/Screen%2BShot%2B2015-03-21%2Bat%2B00.08.57.png" /></a></div>
<br />
You should now find the track in the "Track Manager" on your GPS. Select "View Map" to see it and then "Go" if you want to navigate along it. Depending on the maps you have on your device, you can also display an elevation plot. Since the original track don't contain elevation data, the GPS will try to fetch it from your map.<br />
<br />
My GPS is now loaded and I'm ready to go!<br />
<br />
All data are <a href="https://github.com/turban/nordryggen/tree/gh-pages/data">available on GitHub</a>.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-65857167776218647412015-03-20T19:39:00.000+00:002015-03-22T16:23:57.941+00:00Nordryggen on skis for 25 days - creating a route map<div dir="ltr" style="text-align: left;" trbidi="on">
I’m currently doing my last preparations for a 25 days skiing trip across Nordryggen in Norway. It will of course depend on weather, snow conditions and blisters, but hopefully the conditions will be bearable. Norway has a great <a href="http://english.turistforeningen.no/index.php?fo_id=3610">network of 500 cabins</a> maintained by the <a href="http://english.turistforeningen.no/">Norwegian Trekking Association</a>. The longest connected cross country skiing track I’ve found is around 500 km, - how to map it?<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-es-3kkCX6cU/VQx0uvAJNLI/AAAAAAAAPnA/M1oKuPWXYhY/s1600/nordryggen-cartodb.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-es-3kkCX6cU/VQx0uvAJNLI/AAAAAAAAPnA/M1oKuPWXYhY/s1600/nordryggen-cartodb.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The map we're going to create with QGIS and CartoDB. Data from the <a href="http://www.kartverket.no/en/About-The-Norwegian-Mapping-Authority/">Norwegian Mapping Authority</a>.</td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<a href="http://artikkel.ut.no/fjellkjeden-skal-hete-nordryggen-1.11234213">Nordryggen</a> (“the north ridge”) is a fairly new name of <a href="http://en.wikipedia.org/wiki/Scandinavian_Mountains">the 1,700 km mountain range</a> that runs through the Scandinavian Peninsula. My plan is to ski around 500 km in the southern part of Norway, most of it above the tree line.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-7Rb_dVT3U14/VQx5K8WOa5I/AAAAAAAAPnM/6VtGedDlQqs/s1600/jotunheimen.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-7Rb_dVT3U14/VQx5K8WOa5I/AAAAAAAAPnM/6VtGedDlQqs/s1600/jotunheimen.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cross-country skiing in Jotunheimen. Photo: Bjørn Sandvik</td></tr>
</tbody></table>
<br />
You can study the <a href="http://english.turistforeningen.no/index.php?fo_id=8209">waymarked ski routes</a> on <a href="http://ut.no/kart?lat=61.50173&lng=8.51715&zoom=10&hytter=false&fotturer=false&sykkelturer=false&klatreturer=false&padleturer=false&skiturer=false&baselayer=0&sommerstier=false&vinterloyper=true&skifore=false">UT.no</a>, or download the data from the <a href="http://www.kartverket.no/en/About-The-Norwegian-Mapping-Authority/">Norwegian Mapping Authority</a> if you want to map it yourself. The dataset is available as a <a href="http://data.kartverket.no/download/content/nasjonal-database-tur-og-friluftsruter-postgis">PostGIS dump</a> or in <a href="http://data.kartverket.no/download/content/nasjonal-database-tur-og-friluftsruter-sosi">SOSI</a>. SOSI is a common <a href="http://en.wikipedia.org/wiki/SOSI">vector data format</a> used to exchange geographical information in Norway, and not very well supported by various mapping applications. Luckily we have <a href="http://sosicon.espenandersen.no/">Sosicon</a>, a great open source converter by <a href="http://sosicon.espenandersen.no/">Espen Andersen</a>. I ran this command on the SOSI file:<br />
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">./sosicon -2shp Tur\ og\ friluftsruter.sos </span></div>
<br />
In return I got 4 shapefiles for ski routes, hiking trails, bike trails and POIs.<br />
<br />
If you open the <a href="https://github.com/turban/nordryggen/blob/gh-pages/data/Tur%20og%20friluftsruter_Skiloype.zip?raw=true">ski routes shapefile</a> in <a href="http://www.qgis.org/">QGIS</a> it won’t tell you much without a basemap. Let's use the <a href="http://kartverket.no/kart/gratis-kartdata/cache-tjenester/">map tile service</a> from the Norwegian Mapping Authority. In QGIS, click on the “Add WMS/WMTS Layer” button in the left toolbar. Click the “New” button to create a connection. Add a name and copy this URL:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">http://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?Version=1.0.0&service=wmts&request=getcapabilities</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-YRa1_5S267Y/VQwgtfQwtxI/AAAAAAAAPls/_aOwtFoucPE/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B00.56.24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-YRa1_5S267Y/VQwgtfQwtxI/AAAAAAAAPls/_aOwtFoucPE/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B00.56.24.png" /></a></div>
<br />
<br />
Click “OK” and “Connect”. You will now get a long list of layers in different map projections. I recommend using “norges_grunnkart” or “topo2” (detailed) in ESPG:32633 (UTM 33).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Ezdko2a2A10/VQwg29cQC5I/AAAAAAAAPl0/6xfJmpnoauQ/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B01.02.59.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-Ezdko2a2A10/VQwg29cQC5I/AAAAAAAAPl0/6xfJmpnoauQ/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B01.02.59.png" /></a></div>
<br />
<br />
Click on “Add” and you should see a topographic map of Norway. Now you can add <a href="https://github.com/turban/nordryggen/blob/gh-pages/data/Tur%20og%20friluftsruter_Skiloype.zip?raw=true">the shapefile</a>, and the ski tracks will show on top.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-QR4hJDYsoqM/VQwiYAl23WI/AAAAAAAAPmI/LR9m6rzyG2A/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B14.35.37.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-QR4hJDYsoqM/VQwiYAl23WI/AAAAAAAAPmI/LR9m6rzyG2A/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B14.35.37.png" height="555" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Waymarked ski routes shown in QGIS with my route selected between <a href="https://sotaseter.turistforeningen.no/cabin.php?ca_id=107&fo_id=5240&lang=eng">Sota Sæter</a> and <a href="http://en.wikipedia.org/wiki/Ljosland">Ljosland</a>.</td></tr>
</tbody></table>
<br />
I selected the track segments I plan to follow, and saved the selection in a new <a href="https://github.com/turban/nordryggen/blob/gh-pages/data/route.zip?raw=true">route shapefile</a>. I want to have the route as a continuous line with the coordinates in order, as this will allow me to use it for navigation with my GPS unit (<a href="http://blog.thematicmapping.org/2015/03/transferring-route-from-qgis-to-your-gps.html">see my next blog post</a>). I'm using the "<a href="https://github.com/dgoedkoop/joinmultiplelines">Join multiple lines</a>" plugin to get the desired result.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-AbV1zxU2w3A/VQxYFYo-ZLI/AAAAAAAAPmk/XcM_bzbWD28/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B15.28.04.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-AbV1zxU2w3A/VQxYFYo-ZLI/AAAAAAAAPmk/XcM_bzbWD28/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B15.28.04.png" height="388" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Installing plugins is very easy with the QGIS Plugin Manager. After installation, you'll find the "Join multiple lines" plugin in the Vector menu. </td></tr>
</tbody></table>
<br />
You can use the Field calculator to calculate the length of the continuous track:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-LAm-Ll4OiyE/VQwqATsAwpI/AAAAAAAAPmU/NaBfAfRdLlg/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B15.06.37.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-LAm-Ll4OiyE/VQwqATsAwpI/AAAAAAAAPmU/NaBfAfRdLlg/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B15.06.37.png" /></a></div>
<br />
This outputs a length of 505 km.<br />
<br />
Let's move on to <a href="https://cartodb.com/">CartoDB</a> to create the route map. First, I'm uploading the <a href="https://github.com/turban/nordryggen/blob/gh-pages/data/route.zip?raw=true">zipped route shapefile</a> to CartoDB. I've also created a table with the cabin name and positions along the route.<br />
<br />
Create a new visualzation and add the route and cabin tables. You can add the same basemap as we used in QGIS with this URL:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=norges_grunnkart&zoom={z}&x={x}&y={y}</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-5FmtokHfsZ8/VQxw8s4mAJI/AAAAAAAAPm0/oArPajSC4BU/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B19.39.53.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-5FmtokHfsZ8/VQxw8s4mAJI/AAAAAAAAPm0/oArPajSC4BU/s1600/Screen%2BShot%2B2015-03-20%2Bat%2B19.39.53.png" /></a></div>
<br />
The cabins are styled differently depending on the zoom level. This is the final map:<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="620" mozallowfullscreen="" msallowfullscreen="" oallowfullscreen="" src="http://turban.cartodb.com/viz/526e1f26-cf30-11e4-b74f-0e018d66dc29/embed_map" webkitallowfullscreen="" width="100%"></iframe>
<br />
All data is <a href="https://github.com/turban/nordryggen/tree/gh-pages/data">available on GitHub</a>. Map data from the <a href="http://www.kartverket.no/en/About-The-Norwegian-Mapping-Authority/">Norwegian Mapping Authority</a>.
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-39589680707046992092014-10-12T20:35:00.003+01:002015-05-30T13:08:22.052+01:00Creating 3D terrains with Cesium<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Previously, I’ve used three.js to create 3D terrain maps in the browser (<a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs-part-1.html">1</a>, <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs.html">2</a>, <a href="http://blog.thematicmapping.org/2013/10/textural-terrains-with-threejs.html">3</a>, <a href="http://blog.thematicmapping.org/2013/10/terrain-visualization-with-threejs-and.html">4</a>, <a href="http://blog.thematicmapping.org/2013/11/showing-gps-tracks-in-3d-with-threejs.html">5</a>, <a href="http://blog.thematicmapping.org/2014/03/using-web-map-services-with-threejs.html">6</a>). It worked great for smaller areas, but <a href="http://threejs.org/">three.js</a> doesn’t have built-in support for tiling and advanced <a href="http://en.wikipedia.org/wiki/Level_of_detail">LOD algorithms</a> needed to render large terrains. So I decided to take <a href="http://cesiumjs.org/">Cesium</a> for a spin.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-h2IzmAYKHU8/VDrSJWc9izI/AAAAAAAAOYc/ltcOaTjnaO8/s1600/terrain.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="http://4.bp.blogspot.com/-h2IzmAYKHU8/VDrSJWc9izI/AAAAAAAAOYc/ltcOaTjnaO8/s1600/terrain.png" width="640" /></a></div>
<br />
<a href="http://cesiumjs.org/">Cesium</a> is a JavaScript library for creating 3D globes and 2D maps in the browser without a plugin. Like three.js, it uses WebGL for hardware-accelerated graphics. Cesium allows you to add your own terrain data, and this blog post will show you how.<br />
<br />
<blockquote class="twitter-tweet" data-cards="hidden" lang="en">
Impressed by the terrain rendering in <a href="https://twitter.com/CesiumJS">@CesiumJS</a> - with a 10m elevation model for Norway! Farewell Google Earth. <a href="http://t.co/RQKvfu2hBb">pic.twitter.com/RQKvfu2hBb</a><br />
— Bjørn Sandvik (@thematicmapping) <a href="https://twitter.com/thematicmapping/status/518405048658059264">October 4, 2014</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
<br />
Compared to <a href="http://www.gearthblog.com/blog/archives/2014/09/64-bit-chrome-drops-support-google-earth-plugin.html">the dying Google Earth plugin</a>, it's quite complicated to get started with Cesium. The source code is <a href="http://cesiumjs.org/refdoc.html">well documented</a> and the <a href="http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Hello%20World.html&label=Showcases">live coding Sandcastle</a> is great, but there is a <a href="http://cesiumjs.org/tutorials.html">lack of tutorials</a> and my development slows down when I have to <a href="https://cesiumjs.org/Cesium/Build/Documentation/Camera.html">deal with a lot of math</a>. <br />
<br />
That said, I was able to create an app streaming my own terrain and imagery with a few lines of code. There is also <a href="http://www.webglearth.org/">WebGL Earth</a>, a wrapper around Cesium giving you an API similar to well-known <a href="http://leafletjs.com/">Leaflet</a>. I expect to see more functions or wrappers to make stuff like camera positioning easier in the future.<br />
<br />
<b>How can you add your own terrain data to Cesium? </b><br />
<br />
First, you need to check if you really need it. You have the option to stream <a href="http://cesiumjs.org/data-and-assets/terrain/stk-world-terrain.html">high-resolution terrain data</a> directly from the servers at <a href="http://www.agi.com/">AGI</a>. It's free to use on public sites under the <a href="http://cesiumjs.org/data-and-assets/terrain/stk-world-terrain.html#TermsOfUse">terms of use</a>. If you want to host the terrain data on your own servers, AGI provides a commercial product - the <a href="http://www.agi.com/products/stk/terrain-server/">STK Terrain Server</a>. Give it a try, if you have a budget!<br />
<br />
I was looking for an open source solution, and found out that Cesium supports two terrain formats:<br />
<ol style="text-align: left;">
<li><a href="http://cesiumjs.org/data-and-assets/terrain/formats/heightmap-1.0.html">heightmap</a></li>
<li><a href="http://cesiumjs.org/data-and-assets/terrain/formats/quantized-mesh-1.0.html">quantized-mesh</a></li>
</ol>
The <a href="http://cesiumjs.org/data-and-assets/terrain/formats/heightmap-1.0.html">tiled heightmap format</a> is similar to <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs-part-1.html">the one I used for three.js</a>. Each tile contains 65 x 65 height values, which overlap their neighbors at their edges to create a seamless terrain. Cesium translates the heightmap tiles into a uniform triangle mesh, <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs.html">as I did in three.js</a>. The downside of this format is the uniform grid, you use the same amount of data to represent both flat and hilly terrain.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-R_BgZsuAQog/VDrQT-JAYOI/AAAAAAAAOYI/XU9D_pooIkY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.01.39.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://3.bp.blogspot.com/-R_BgZsuAQog/VDrQT-JAYOI/AAAAAAAAOYI/XU9D_pooIkY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.01.39.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The regular terrain mesh made from heightmap tiles. </td></tr>
</tbody></table>
<br />
The <a href="http://cesiumjs.org/data-and-assets/terrain/formats/quantized-mesh-1.0.html">quantized-mesh format</a> follows the same tile structure as heightmap tiles, but each tile is better optimised for large-scale terrain rendering. Instead of creating a dense, uniform triangle mesh in the browser, an <a href="http://en.wikipedia.org/wiki/Triangulated_irregular_network">irregular triangle mesh</a> is pre-rendered for each tile. It's a better representation of the landscape, having less detail in flat areas while increasing the density in steep terrain. The mesh terrain is also more memory efficient and renders faster.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-6Z8JFcpKXKg/VDrQaid5PII/AAAAAAAAOYQ/m6-EaOQhfPY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.02.10.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://4.bp.blogspot.com/-6Z8JFcpKXKg/VDrQaid5PII/AAAAAAAAOYQ/m6-EaOQhfPY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.02.10.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The irregular terrain mesh from quantized-mesh tiles. Larger triangles have less height variation. </td></tr>
</tbody></table>
<br />
Unfortunately, <a href="http://stackoverflow.com/a/25965415">I haven't found</a> any open source tools to create tiles in the quantized-mesh format - please notify me if you know how to do it!<br />
<br />
You can generate heightmap tiles with <a href="https://github.com/geo-data/cesium-terrain-builder">Cesium Terrain Builder</a>, a great command-line utility by <a href="https://twitter.com/HommeZwaagstra">Homme Zwaagstra</a> at the <a href="http://www.geodata.soton.ac.uk/geodata/">GeoData Institute</a>, University of Southampton.<br />
<br />
I'm using <a href="http://blog.thematicmapping.org/2013/10/terrain-building-with-threejs-part-1.html">the same elevation data</a> as I did for my three.js maps, but this time in full 10 meter resolution. I'm just clipping the data to my focus area (<a href="http://en.wikipedia.org/wiki/Jotunheimen">Jotunheimen</a>) using <a href="http://spatialreference.org/ref/epsg/wgs-84/">EPSG:4326</a>, the World Geodetic System (WGS 84).<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">gdalwarp -t_srs EPSG:4326 -te 7.2 60.9 9.0 61.7 -co compress=lzw -r bilinear jotunheimen.vrt jotunheimen.tif</span><br />
<br />
I went for the easy option, and <a href="https://github.com/geo-data/cesium-terrain-builder#installation">installed Cesium Terrain Builder</a> using the <a href="https://registry.hub.docker.com/u/homme/cesium-terrain-builder/">Docker image</a>. First I installed <a href="http://penandpants.com/2014/03/09/docker-via-homebrew/">Docker via Homebrew</a>. I was not able to mount my hard drive with this method, so I downloaded the elevation data from my public Dropbox folder:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">wget https://dl.dropboxusercontent.com/u/1234567/jotunheimen.tif</span><br />
<br />
I used the <a href="https://github.com/geo-data/cesium-terrain-builder#ctb-tile">ctb-tile command</a> to generate the tileset:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">ctb-tile --output-dir ./tiles jotunheimen.tif</span><br />
<br />
The command returned 65 000 tiles down to zoom level 15. I compressed the tiles into one file:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">tar cvzf tiles.tar.gz tiles</span><br />
<br />
and used the <a href="http://xmodulo.com/access-dropbox-command-line-linux.html">Dropbox uploader</a> to get the tiles back to my hard drive:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">./dropbox_uploader.sh upload tiles.tar.gz tiles.tar.gz</span><br />
<br />
So I got 65 000 terrain tiles on my server, how can I see the beauty in Cesium? It required some extra work:<br />
<ol style="text-align: left;">
<li>First I had to add a <a href="https://github.com/geo-data/cesium-terrain-builder/issues/1">missing top level tile</a> that Cesium was expecting. </li>
<li>Cesium was also looking for a layer.json file which I had to create:<br /><br /><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">{<br /> "tilejson": "2.1.0",<br /> "format": "heightmap-1.0",<br /> "version": "1.0.0",<br /> "scheme": "tms",<br /> "tiles": ["{z}/{x}/{y}.terrain?v={version}"]<br />}<br /></span></li>
<li>Lastly, I added a <a href="http://en.wikipedia.org/wiki/.htaccess">.htaccess</a> file to support <a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a> and gzipped terrain tiles: </li>
</ol>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-ZM3MfZPwJUk/VDrZDO_T8BI/AAAAAAAAOY8/HL65mdc5GE0/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.39.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-ZM3MfZPwJUk/VDrZDO_T8BI/AAAAAAAAOY8/HL65mdc5GE0/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.39.17.png" /></a></div>
<div>
<br /></div>
</div>
Then I was ready to go!<br />
<div>
<br /></div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-yHG-7s1qdLc/VDrVD0zXxfI/AAAAAAAAOYo/wxKMTX5sYZs/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.22.20.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://1.bp.blogspot.com/-yHG-7s1qdLc/VDrVD0zXxfI/AAAAAAAAOYo/wxKMTX5sYZs/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.22.20.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Beautiful terrain rendered with <a href="http://data.kartverket.no/download/content/geodataprodukter?korttype=3595&aktualitet=All&datastruktur=All&dataskema=All">10 m elevation data</a> from the <a href="http://statkart.no/en/">Norwegian Mapping Authority</a>. Those who know Jotunheimen, will notice Skogadalsbøen by the river and Stølsnostind and Falketind surrounded by glaciers in the background.</td></tr>
</tbody></table>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-FnYeeKKS9WQ/VDrVnjOX1UI/AAAAAAAAOYw/ufIkMS_c7BY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.24.54.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="http://1.bp.blogspot.com/-FnYeeKKS9WQ/VDrVnjOX1UI/AAAAAAAAOYw/ufIkMS_c7BY/s1600/Screen%2BShot%2B2014-10-12%2Bat%2B21.24.54.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The terrain is a bit blocky (see the mount Falketind to the left), but <a href="https://github.com/geo-data/cesium-terrain-builder/issues/4">I'm not sure if this is happening in Cesium Terrain Builder or Cesium itself</a>. The quantized-mesh tiles from AGI gives a better result. </td></tr>
</tbody></table>
<br />
I'm not able so show an interactive version, as I'm using detailed aerial imagery from <a href="http://www.norgeibilder.no/">"Norge i bilder"</a>, which are not publicly available.<br />
<br />
<b>UPDATE: </b><br />
<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">No more blocky terrain with <a href="https://twitter.com/CesiumJS">@CesiumJS</a> Terrain Builder: <a href="https://t.co/mUb7n98NQy">https://t.co/mUb7n98NQy</a> - try it out! <a href="https://twitter.com/hashtag/geomatikk?src=hash">#geomatikk</a> <a href="http://t.co/aWwihx0Nsw">pic.twitter.com/aWwihx0Nsw</a></p>— Bjørn Sandvik (@thematicmapping) <a href="https://twitter.com/thematicmapping/status/604528301936406528">May 30, 2015</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></div>Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-4741970181714760187.post-12698247338110020512014-08-29T13:32:00.000+01:002014-09-12T21:23:56.913+01:00Geotagging and Picasa Web Albums API, or was it Google+ Photos?<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://blog.thematicmapping.org/2014/08/showing-geotagged-photos-on-leaflet-map.html">In my last blog post</a>, I presented a new plugin, <a href="https://github.com/turban/Leaflet.Photo">Leaflet.Photo</a>, that allows you to display geotagged photos from any source. Among them was Google+ Photos and Picasa Web Albums API. My plan is to use this API for <a href="http://blog.thematicmapping.org/2014/08/making-real-time-travel-map.html">my travel map</a>, and this is why.<br />
<br />
<b>Does Picasa Web Albums still exist? </b><br />
It's a bit messy these days. Google is trying to transition from Picasa Web Albums to Google+ Photos, as photos are the number one things that people want to share on social networks. When you use <a href="http://picasa.google.com/">Picasa</a> to share your albums (<a href="https://support.google.com/picasa/answer/106176">Sync to Web</a>), the album URL is now on your Google+ profile, and not on Picasa Web Albums (which is just redirecting me to Google+). This is the URL to the public album from <a href="http://blog.thematicmapping.org/2014/08/live-tracking-in-lofoten-and-vesteralen.html">my trip to the Trollfjord</a>:<br />
<br />
<a href="https://plus.google.com/photos/+Bj%C3%B8rnSandvik/albums/6052628080819524545">https://plus.google.com/photos/+BjørnSandvik/albums/6052628080819524545</a><br />
<br />
It also works with your Google+ user id:<br />
<br />
<span style="color: #1155cc; font-family: Arial; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"><a href="https://plus.google.com/photos/118196887774002693676/albums/6052628080819524545" style="text-decoration: none;">https://plus.google.com/photos/118196887774002693676/albums/6052628080819524545</a></span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-x15EPoTdl6I/VABlYCLrJ1I/AAAAAAAANmo/ATCpy7mOPXI/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B13.34.07.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-x15EPoTdl6I/VABlYCLrJ1I/AAAAAAAANmo/ATCpy7mOPXI/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B13.34.07.png" height="412" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="https://plus.google.com/photos/+Bj%C3%B8rnSandvik/albums/6052628080819524545">My public Google+ web album</a>. The album contains both photos and videos. </td></tr>
</tbody></table>
<br />
The thing is, there is no <a href="https://developers.google.com/+/api/">Google+ API</a> for photos and videos yet (<a href="http://siliconfilter.com/google-gets-an-api-for-photos-and-videos/">apparently they were working on it back in 2011</a>). But the <a href="https://developers.google.com/picasa-web/">Google Web Albums API</a> still works on your Google+ albums.<br />
<br />
Google Web Albums API is not the easiest API I've worked with, but it's flexible and quite fast. This is an XML feed of my public album from Trollfjord:<br />
<br />
<a href="https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545">https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545</a><br />
<br />
The user number and album id is the same as above. Or better for your JavaScript apps, a JSON feed:<br />
<br />
<a href="https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json">https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json</a><br />
<br />
And if you're still using JSONP:<br />
<br />
<a href="https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json-in-script">https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json-in-script</a><br />
<br />
If you click on any of these links, you'll see that it's not a very compact format. There is a lot of data that you don't need. Although complicated, you can <a href="https://developers.google.com/gdata/docs/2.0/reference#fields">select the fields</a> you want to include in the feed. This is how I selected the following elements:<br />
<ul style="text-align: left;">
<li>Photo URL: entry/media:group/media:content</li>
<li>Photo caption: entry/media:group/media:description</li>
<li>Photo thumbnail URL: entry/media:group/media:thumbnail</li>
<li>Photo timestamp: entry/gphoto:timestamp</li>
<li>Photo location: entry/georss:where</li>
</ul>
<br />
This is the new URL:<br />
<br />
<span id="docs-internal-guid-9fdf7418-219f-ce07-938a-447dfac78058"><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"><a href="https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json&fields=entry/media:group/media:content,entry/media:group/media:description,entry/media:group/media:thumbnail,entry/gphoto:timestamp,entry/georss:where">https://picasaweb.google.com/data/feed/api/user/118196887774002693676/albumid/6052628080819524545?alt=json&<b>fields</b>=entry/media:group/media:content,entry/media:group/media:description,entry/media:group/media:thumbnail,entry/gphoto:timestamp,entry/georss:where</a></span></span><br />
<br />
While researching, I also learnt that I could use the imgmax attribute to specify the size of the photos referenced in the photo URL. Neat!<br />
<br />
<b>So why should I use this (relatively) old API?</b><br />
<a href="http://www.embeddedmetadata.org/social-media-test-results.php">Compared to other popular social media sites</a>, Google don't strip off the meta information of your photos. Instead it uses the build in support for image metadata extensively. Hopefully Google will continue to do this, although social media sites have <a href="http://www.arguslabs.com/blog/facebook-twitter-stripping-context/">reasons not doing so</a>.<br />
<br />
This means that Google don't lock you in. I can change the location of my photos using my GPS tracks, and it's reflected where I embed my photos. I can edit the image captions in Picasa and it's stored within the image file, allowing me to write the caption once and use it everywhere.<br />
<br />
So what is my album workflow for my travel map. Before starting my journey, I'm creating a new Google+ album. The feed from this album is attached to my map, by simply passing on the album id. While on journey, I use the <a href="https://support.google.com/plus/answer/3453521">Google Photos app</a> to add photos to the album, that will automagically show up on the map as well. Back from trip, I can add and edit photos from my digital camera in Picasa and sync them to the web album.<br />
<br />
<b><i>Update 12 September 2015: </i></b><i>I'm having trouble uploading images with the Google photos app. The images are geotagged and the location data shows in the Google+ album, but unfortunately the location data is not included in the API feed. Please notify me if you're able to get this to work. </i><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-ZqCT78ZD3mo/VABw7pPY4eI/AAAAAAAANm4/qKnJ9mOIcuc/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B14.23.29.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-ZqCT78ZD3mo/VABw7pPY4eI/AAAAAAAANm4/qKnJ9mOIcuc/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B14.23.29.png" height="445" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Photos from Google+ shown on my travel map. </td></tr>
</tbody></table>
<br />
PS! This blog post is not sponsored by Google :-) </div>
Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-4741970181714760187.post-33541482331198318002014-08-29T09:55:00.000+01:002014-08-29T15:34:55.555+01:00Showing geotagged photos on a Leaflet map<div dir="ltr" style="text-align: left;" trbidi="on">
Using Instagram for <a href="http://blog.thematicmapping.org/2014/08/making-real-time-travel-map.html">my real-time travel map</a> had too many limitations, so I decided to use <a href="https://support.google.com/picasa/answer/1321133?hl=en&ref_topic=1689862">Google+ photos or Picasa Web Albums</a> instead. I've create a new plugin, <a href="https://github.com/turban/Leaflet.Photo">Leaflet.Photo</a>, that allows you to add geotagged photos to your map, from any source.<br />
<div>
<br /></div>
<div>
The plugin plays well with the great <a href="https://github.com/Leaflet/Leaflet.markercluster">Leaflet.markercluster</a> plugin, showing your photos in clusters. To make the plugin more versatile, it doesn't deal with AJAX loading or image presentation except the thumbnails on the map. Use your AJAX loader of choice, and simply pass on an array of photo objects to the plugin. </div>
<div>
<br /></div>
<div>
The photo objects can include the properties you like, but the following are required:</div>
<div>
<ul style="text-align: left;">
<li>lat: latitude of photo</li>
<li>lng: longitude og photo</li>
<li>thumbnail: url to thumbnail photo</li>
</ul>
</div>
<div>
I've kept the squared thumbnails of Instagram, as I think it look nicer than variable size thumbnails. Since the photos can have any dimensions, I'm using <a href="http://stackoverflow.com/a/11552460">a CSS technique</a> to crop and center the thumbnails. </div>
<div>
<br /></div>
<div>
I've created three examples using <a href="https://developers.google.com/picasa-web/docs/2.0/reference">Picasa Web Albums Data API</a>, <a href="https://cartodb.com/">CartoDB</a> (<a href="http://blog.thematicmapping.org/2014/06/syncing-your-instagram-photos-to-cartodb.html">synced with Instagram</a>) and <a href="http://norvegianablog.wordpress.com/">Norvegiana API</a>. With CartoDB you can easily get the required photo properties by manipulating the SQL query. Other APIs will require some data parsing before you pass on the photo objects to the plugin. All examples show the photos in a popup when you click/tap on them, but do whatever you like! On <a href="http://turban.no/">my travel map</a> (click on "Bilder"), I'm using my own lightbox showing all photos in a cluster.</div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Google+ photos</span></div>
<div>
<br /></div>
<div>
<a href="http://turban.github.io/Leaflet.Photo/examples/picasa.html">See example</a> | <a href="https://github.com/turban/Leaflet.Photo/blob/gh-pages/examples/picasa.html">Code</a></div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-ZErp_h4sHeE/VAA7j-nGqdI/AAAAAAAANmA/rzXG7PLGCeQ/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B10.34.14.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-ZErp_h4sHeE/VAA7j-nGqdI/AAAAAAAANmA/rzXG7PLGCeQ/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B10.34.14.png" height="556" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Photos and videos from Google+. See the small animated GIF video thumbnails. </td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Instagram / CartoDB</span></div>
<div>
<br /></div>
<div>
<a href="http://turban.github.io/Leaflet.Photo/examples/cartodb.html">See example</a> | <a href="https://github.com/turban/Leaflet.Photo/blob/gh-pages/examples/cartodb.html">Code</a></div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-aGMmcbnjjjM/VAA7j-pj_6I/AAAAAAAANmI/2sVxm_q4hCE/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B10.32.07.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-aGMmcbnjjjM/VAA7j-pj_6I/AAAAAAAANmI/2sVxm_q4hCE/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B10.32.07.png" height="556" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Instagram photos synced with CartoDB. </td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Norvegiana </span></div>
<div>
<br /></div>
<div>
<a href="http://turban.github.io/Leaflet.Photo/examples/norvegiana.html">See example</a> | <a href="https://github.com/turban/Leaflet.Photo/blob/gh-pages/examples/norvegiana.html">Code</a></div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><span style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-8e31N9kOjTQ/VAA7j0COsWI/AAAAAAAANmE/e5ftBuUmsVU/s1600/Screen%2BShot%2B2014-08-29%2Bat%2B10.35.58.png" height="533" width="640" /></span></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Historic photos of Oslo from Norvegiana API. </td></tr>
</tbody></table>
<div>
<br />
<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/nb_NO/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-post" data-href="https://www.facebook.com/KNreise/posts/735878846479352" data-width="466"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/KNreise/posts/735878846479352">Innlegg</a> av <a href="https://www.facebook.com/KNreise">Kultur- og naturreise</a>.</div></div>
<br /><br /></div>
<div>
Enjoy! :-)</div>
<div>
</div>
</div>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-4741970181714760187.post-24288423695685056342014-08-28T00:40:00.000+01:002014-09-14T22:13:08.509+01:00Geotagging photos using GPS tracks, ExifTool and Picasa<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="font-family: inherit;">I take a lot of photos while trekking, and most of the time I'm also carrying a GPS with me. As my camera don't have a built-in GPS, my photos are not geotagged while shooting. Luckily, this is an easy task if you've kept your GPS logs from the trip. </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">I'm still very happy with my Garmin GPSmap 60CSx that I bought 7 years ago. By changing the setup, the GPS allows me to automatically save the tracks to the memory card. I get one <a href="http://en.wikipedia.org/wiki/GPS_Exchange_Format">GPX file</a> for each day trekking named with the date. I can easily transfer these tracks to my computer or smartphone with a cable or a card reader. </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Before I converted to Mac, I used <a href="http://www.geosetter.de/en/">GeoSetter</a> to geotag my photos on Windows. Now, I want to do it on the command line using the great <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool</a> by Phil Harvey. I installed it on my MacBook using <a href="http://brew.sh/">Homebrew</a>:</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span id="docs-internal-guid-7e7fc109-19bc-9e1c-0cb9-543f5f686bb4"><span style="vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace;">brew install exiftool</span></span></span></div>
<div style="text-align: left;">
<span style="font-family: Arial; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit; vertical-align: baseline; white-space: pre-wrap;">After copying my GPX file to the image folder, I'm simply running: </span></div>
<div style="text-align: left;">
<br /></div>
<div>
<div class="p1" style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">exiftool -geotag=my.gpx ./</span></div>
<div class="p1" style="text-align: left;">
<br />
If you forgot to sync the camera and GPS time before your trip, you can use the <i>geosync-</i>option to fix it: (60:00 = 60 minutes):<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">exiftool -geotag=20140329.gpx -geosync=-60:00 ./</span><br />
<br />
You have a lot of options, so make sure to read the "<a href="http://www.sno.phy.queensu.ca/~phil/exiftool/geotag.html">Geotagging with ExifTool</a>" documentation. ExifTool is modifying the <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">Exif headers</a> of your image files, storing the location data in the same file. </div>
<div class="p1" style="text-align: left;">
<br /></div>
<div class="p1" style="text-align: left;">
To see the result on a map, I'm using <a href="http://picasa.google.com/">Picasa</a>. </div>
<div class="p1">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-B30EcRS75Sg/U_5oEz-pnoI/AAAAAAAAMrI/LOSTWnRVw4A/s1600/Screen%2BShot%2B2014-08-28%2Bat%2B01.21.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-B30EcRS75Sg/U_5oEz-pnoI/AAAAAAAAMrI/LOSTWnRVw4A/s1600/Screen%2BShot%2B2014-08-28%2Bat%2B01.21.13.png" height="474" width="640" /></a></div>
<div class="p1">
<br /></div>
<div class="p1">
Click the map pin button (bottom right) to see the map. If the positions are not shown on the map, try to right-click the image folder and select "Refresh Thumbnails". </div>
<div class="p1">
<br /></div>
<div class="p1">
If you don't have a GPS track you can always use Picasa to manually geotag your photos. </div>
<div class="p1">
<br /></div>
<div class="p1">
Be aware! I just learnt that social media sites like Facebook, Twitter and Instagram <a href="http://www.arguslabs.com/blog/facebook-twitter-stripping-context/">removes the Exif data from your images</a>. Google+ don't. </div>
<div class="p1">
<br /></div>
<div class="p1">
Now, how can you display the photos on your own map? It will be the topic of my next blog post. </div>
</div>
</div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-4741970181714760187.post-29183266035999846652014-08-27T13:52:00.000+01:002014-08-28T12:04:19.248+01:00Live tracking in Lofoten and Vesterålen<div dir="ltr" style="text-align: left;" trbidi="on">
Last weekend, I had a great trip to scenic Lofoten and Vesterålen in Northern Norway. I brought my tracking gear to test <a href="http://blog.thematicmapping.org/2014/08/making-real-time-travel-map.html">my new real time travel map</a>. How did it go?<br />
<div>
<br /></div>
<div>
Our first trip was to <a href="http://en.wikipedia.org/wiki/Trollfjord">Trollfjord</a>, a 2 km long fjord with a narrow entrance and steep-sided mountains. It's a famous tourist spot in <a href="http://en.wikipedia.org/wiki/Lofoten">the Lofoten archipelago</a>, but not many leave the boat at the fjord's end to hike up to the <a href="http://ut.no/hytte/3.2059/">Trollfjord hut</a>.</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-ipQXJ1KOAaA/U_3RcfbeRWI/AAAAAAAAMmo/Lcu3TQLAk6g/s1600/DSC05714.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-ipQXJ1KOAaA/U_3RcfbeRWI/AAAAAAAAMmo/Lcu3TQLAk6g/s1600/DSC05714.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The small Trollfjord hut.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Trollfjord goes in an east-west direction, and I expected to be in the "satellite shadow" being far north and having steep mountains blocking the sky towards the south. My good old Garmin GPSmap 60CSx did well in the rugged landscape, while <a href="http://blog.thematicmapping.org/2014/06/real-time-satellite-tracking-for-your.html">my satellite SPOT messenger</a> had some difficulties finding and sending positions. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-7CMRC_TnBEw/U_3DlqHZiLI/AAAAAAAAMlg/E7WOeRm0nbg/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.39.37.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-7CMRC_TnBEw/U_3DlqHZiLI/AAAAAAAAMlg/E7WOeRm0nbg/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.39.37.png" height="412" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Live track from my SPOT messenger (<a href="http://turban.no/bjorn/trollfjorden">interactive map</a>).</td></tr>
</tbody></table>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-WUMNefn4d24/U_3DqgRKuYI/AAAAAAAAMlo/qJ1-jhbhvsE/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.37.12.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-WUMNefn4d24/U_3DqgRKuYI/AAAAAAAAMlo/qJ1-jhbhvsE/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.37.12.png" height="454" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">GPS track from my Garmin GPS.</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
The great thing of <a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">using CartoDB to sync my SPOT-data</a>, is that you can edit your positions with ease after the trip. </div>
<div>
<br /></div>
<div>
Tip! The default basemaps in CartoDB are not very detailed for Norwegian mountains, but you can easily add a basemap (Topo2) from the Norwegian Mapping Authority ("Kartverket") with this URL: </div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom={z}&x={x}&y={y}</span></div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-UZ2akK0aAtY/U_3GQZuy5dI/AAAAAAAAMl0/UHkvqYoKsic/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.47.13.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-UZ2akK0aAtY/U_3GQZuy5dI/AAAAAAAAMl0/UHkvqYoKsic/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.47.13.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Changing the basemap of CartoDB. </td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
It's then easy to edit or delete the wrong positions:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-WVii7L7-9vw/U_3HMPCRaiI/AAAAAAAAMl8/QTZJUfYzwFo/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.53.31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-WVii7L7-9vw/U_3HMPCRaiI/AAAAAAAAMl8/QTZJUfYzwFo/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B13.53.31.png" height="482" width="640" /></a></div>
<div>
<br /></div>
<div>
Be aware! I was struggling editing my CartoDB-tables from my smartphone, but it was not possible to edit the content of table cells. Hopefully, the CartoDB team will make their editor more mobile friendly in the future. </div>
<div>
<br />
<blockquote class="twitter-tweet" data-conversation="none" lang="en"><p><a href="https://twitter.com/thematicmapping">@thematicmapping</a> We’d love to. Not on current short-term plans. You could do it yourself! Build a mobile app that connects to the API ;)</p>— CartoDB (@cartoDB) <a href="https://twitter.com/cartoDB/statuses/504683930046316544">August 27, 2014</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<br /></div>
<div>
Another issue was to get the correct time and position of <a href="http://blog.thematicmapping.org/2014/06/showing-instagram-photos-and-videos-on.html">Instagram photos on the map</a>. Trollfjord is an area with poor mobile coverage. When I took photos with the Instagram app it was struggling placing the photos on the map. It worked better if I took the photos the the built-in camera app of my phone (with geotagging activated) and then posting the photo with the Instagram app. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-9H2HRbrm-NQ/U_3KECeylXI/AAAAAAAAMmI/kDw-PJobqu4/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B14.06.56.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-9H2HRbrm-NQ/U_3KECeylXI/AAAAAAAAMmI/kDw-PJobqu4/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B14.06.56.png" /></a></div>
<div>
<br /></div>
<div>
If I didn't have mobile coverage, I would just retry posting the photo when back to civilisation. The time associated with the image is when it was sent and not taken. I'm going to check if I can extract the shooting time from the <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">Exif headers</a> of the image.</div>
<div>
<br />
<blockquote class="twitter-tweet" lang="en">
Too bad! <a href="https://twitter.com/instagram">@instagram</a> removes the EXIF data from your photos, making it impossible to find the original time and location.<br />
— Bjørn Sandvik (@thematicmapping) <a href="https://twitter.com/thematicmapping/statuses/504657565654208512">August 27, 2014</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
</div>
<div>
Our second trip went through <a href="http://en.wikipedia.org/wiki/M%C3%B8ysalen_National_Park">Møysalen national park</a>, one of very few national parks in Norway that goes all the way down to sea level. </div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-oupCCfGZYdc/U_3RxwHU5HI/AAAAAAAAMmw/K6IVTbev0YA/s1600/DSC05920.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-oupCCfGZYdc/U_3RxwHU5HI/AAAAAAAAMmw/K6IVTbev0YA/s1600/DSC05920.JPG" height="428" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Møysalen national park</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Here we went in a south-north direction, and my SPOT messenger did better as there was less mountains blocking the satellites. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-BX9Szxloqfo/U_3Ov8aOIoI/AAAAAAAAMmc/uYEPydC9PyM/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B14.26.49.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-BX9Szxloqfo/U_3Ov8aOIoI/AAAAAAAAMmc/uYEPydC9PyM/s1600/Screen%2BShot%2B2014-08-27%2Bat%2B14.26.49.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Map and elevation profile of a 2-day hike through Møysalen national park (<a href="http://turban.no/bjorn/moysalen">interactive map</a>). </td></tr>
</tbody></table>
<div>
<br /></div>
<div>
The <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">web service from the Norwegian Mapping Authority</a> ("Kartverket") seemed to have some technical troubles this weekend, so the altitude values and place names was not updated instantly. When the web service was failing my script stopped and <a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">the weather report from yr.no</a> was not fetched either. I'm going to improve the error handling before my next trip. </div>
<div>
<br /></div>
<div>
I also took a lot of photos with my compact camera while trekking, and I would like to show these on the map as well. My camera don't have a GPS receiver, but I should be able to <a href="http://en.wikipedia.org/wiki/Geotagging">geotag</a> my photos by using my GPS track. It will be the topic of my next blog post. In the meanwhile, here are some of the photos: </div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-lFoKj6B5uHs/U_3SW7dbLxI/AAAAAAAAMm8/e4VJXghlbdM/s1600/DSC05689.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-lFoKj6B5uHs/U_3SW7dbLxI/AAAAAAAAMm8/e4VJXghlbdM/s1600/DSC05689.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Hurtigruta in Trollfjord</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-8PihWI4aPM0/U_3T4q-nZ8I/AAAAAAAAMoE/GYPFBOiAnuI/s1600/DSC05722.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-8PihWI4aPM0/U_3T4q-nZ8I/AAAAAAAAMoE/GYPFBOiAnuI/s1600/DSC05722.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Trollfjord by night</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-2TtpI0aK8GA/U_3SW7cfMvI/AAAAAAAAMnA/K11g27Yv-i0/s1600/DSC05726.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-2TtpI0aK8GA/U_3SW7cfMvI/AAAAAAAAMnA/K11g27Yv-i0/s1600/DSC05726.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cloudberries</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-XIlQAlxeoHg/U_3SXR8TMuI/AAAAAAAAMnE/TFITxCdZEvU/s1600/DSC05753.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-XIlQAlxeoHg/U_3SXR8TMuI/AAAAAAAAMnE/TFITxCdZEvU/s1600/DSC05753.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Trollfjordtindan.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-Zg74fBxiOao/U_3SXs3M0dI/AAAAAAAAMnw/7O8ZcLP2bcs/s1600/DSC05807.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-Zg74fBxiOao/U_3SXs3M0dI/AAAAAAAAMnw/7O8ZcLP2bcs/s1600/DSC05807.JPG" height="428" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Seagull</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-_4DMaQposgo/U_3SXx4Gw0I/AAAAAAAAMnI/yHrfw2vuYtY/s1600/DSC05824.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-_4DMaQposgo/U_3SXx4Gw0I/AAAAAAAAMnI/yHrfw2vuYtY/s1600/DSC05824.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Seagulls</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-lM4DlFVM0k0/U_3SW5xHRDI/AAAAAAAAMm4/0ssPaPwk1vs/s1600/DSC05656.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-lM4DlFVM0k0/U_3SW5xHRDI/AAAAAAAAMm4/0ssPaPwk1vs/s1600/DSC05656.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sea eagle in Raftsundet.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-_UksgxWGsDs/U_3SYAYqByI/AAAAAAAAMnM/DGzqwYLrDlE/s1600/DSC05934.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-_UksgxWGsDs/U_3SYAYqByI/AAAAAAAAMnM/DGzqwYLrDlE/s1600/DSC05934.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Durmålstindan</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-oPkD6usxROc/U_3SYsx2vAI/AAAAAAAAMnQ/wgYwaa_ming/s1600/DSC06044.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-oPkD6usxROc/U_3SYsx2vAI/AAAAAAAAMnQ/wgYwaa_ming/s1600/DSC06044.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Tverrelvtindan</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-pzR-4saH8-0/U_3SY6WP1II/AAAAAAAAMnU/oqDC585BH9c/s1600/DSC06059.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-pzR-4saH8-0/U_3SY6WP1II/AAAAAAAAMnU/oqDC585BH9c/s1600/DSC06059.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cold and fresh bath at <a href="http://ut.no/hytte/3.1689/">Snytindhytta</a>.</td></tr>
</tbody></table>
<div>
<br /></div>
</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4741970181714760187.post-5858203105485373582014-08-18T14:36:00.000+01:002014-08-29T13:51:58.500+01:00Making a real time travel map<div dir="ltr" style="text-align: left;" trbidi="on">
I had to quit <a href="http://blog.thematicmapping.org/2014/07/live-tracking-from-oslo-to-bergen-by.html">my trip form Oslo to Bergen</a> already on day three - and I have to wait until August 2015 for a second try. I still got time to gain some experience in real time tracking - and mapping. Based on this experience I've made a new version of my live travel map: <a href="http://turban.no/">turban.no</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-HVSs-bs1c8c/U_H-O7Nyy9I/AAAAAAAAMOo/PmITjmoWgiw/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.23.02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-HVSs-bs1c8c/U_H-O7Nyy9I/AAAAAAAAMOo/PmITjmoWgiw/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.23.02.png" /></a></div>
<br />
<br />
This is a private project to learn new skills - where I care more about new standards and less about old browsers. I'm using CSS3 and HTML5 extensively, the the map will probably not show in Internet Explorer < 10, but it should work well on your tablet or smartphone.<br />
<br />
<blockquote class="twitter-tweet" lang="en"><p>.<a href="https://twitter.com/thematicmapping">@thematicmapping</a> has upped the bar for travel maps! <a href="https://twitter.com/LeafletJS">@LeafletJS</a>, <a href="https://twitter.com/cartoDB">@cartoDB</a>, <a href="https://twitter.com/Highcharts">@Highcharts</a>. Oh my. Beautiful and useful | <a href="http://t.co/AAW6A0TinF">http://t.co/AAW6A0TinF</a></p>— Zev Ross (@zevross) <a href="https://twitter.com/zevross/statuses/494880743223357440">July 31, 2014</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<br />
<a href="http://blog.thematicmapping.org/2014/07/live-tracking-from-oslo-to-bergen-by.html">My previous map</a> was about 1 MB to load on my mobile, as I really took off mixing Leaflet, Highcharts, Ext JS, jQuery and Fancybox. I'm now left with only <a href="http://leafletjs.com/">Leaflet</a> and <a href="http://d3js.org/">D3.js</a> and only 72 kB gzipped JavaScript. It was a bit more work to create an elevation chart width D3.js, but it's very flexible when you get the grasp of it. I also used D3.js to create a lightbox gallery to <a href="http://blog.thematicmapping.org/2014/06/showing-instagram-photos-and-videos-on.html">show my Intagram photos</a>, as it can easily replace jQuery for selectors and animations.<br />
<br />
This is a single page application running in your browser with a <a href="https://cartodb.com/">CartoDB</a>-backend. The only thing I've changed on my server is the <a href="http://en.wikipedia.org/wiki/Htaccess">.htaccess</a> file to point all request to the same index.html file. Then I'm using the <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history">HTML5 History API</a> to create nice looking URLs to different trips. I've also extended the application to support different users, but I have no plans to create a public web service.<br />
<br />
The full application code is not available, but the different bits and pieces are and will. It's still work in progress. The next steps will be to improve the experience on touch screens, add a 3D display and maybe create a mobile app with PhoneGap.<br />
<br />
I want to share some experiences I had when creating this map - and I would very much like your feedback!<br />
<br />
When you <a href="http://turban.no/">visit the site</a>, you can select between different trips. I'm creating new trips by simply adding new rows to a CartoDB-table. The track and images for each trip are fetched based on time attributes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-hIynC751eJw/U_HzsVohPuI/AAAAAAAAMNU/7aqQb-soZQo/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.33.37.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-hIynC751eJw/U_HzsVohPuI/AAAAAAAAMNU/7aqQb-soZQo/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.33.37.png" /></a></div>
<br />
You can also link directly to a trip, like: <a href="http://turban.no/bjorn/oslo-gaastjern">http://turban.no/bjorn/oslo-gaastjern</a><br />
<br />
You can mouseover or click the track to se <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">place names and altitudes</a>. To improve the performance, I'm only drawing the line and not the individual points. To find the nearest point to a mouse/tap position, I'm doing a <a href="https://github.com/darkskyapp/sphere-knn">nearest neighbour search</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-VbQkT6wsDFg/U_H1t3brR2I/AAAAAAAAMNg/IRnP23_Tv6M/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.43.20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-VbQkT6wsDFg/U_H1t3brR2I/AAAAAAAAMNg/IRnP23_Tv6M/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.43.20.png" /></a></div>
<br />
Actually I'm drawing two track lines; the stippled line, and a thicker invisible line to make it easier to catch mouseover and click events, especially on touch devices. This is the line shown with less transparency:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-2BdU7_4C7zA/U_H2yGSXfEI/AAAAAAAAMNo/n-3gY-Sw7i4/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.46.31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-2BdU7_4C7zA/U_H2yGSXfEI/AAAAAAAAMNo/n-3gY-Sw7i4/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.46.31.png" /></a></div>
<br />
The image above show the popup, with terrain type and a <a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">weather forecast for this specific location</a> at the time I was there. The track interactions are also linked to the elevation chart:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-oARqdoC9T4I/U_H3z6N649I/AAAAAAAAMN0/sizsEG5q1yk/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.55.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-oARqdoC9T4I/U_H3z6N649I/AAAAAAAAMN0/sizsEG5q1yk/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B14.55.12.png" /></a></div>
<br />
If you mouseover the track, the same position will show on the elevation chart, and vice versa. Both the track and the chart show <a href="http://blog.thematicmapping.org/2014/06/real-time-tracking-with-spot-and-leafet.html">the live position</a> with a pulsing marker. I'm also marking the overnight stays, as <a href="http://blog.thematicmapping.org/2014/06/real-time-satellite-tracking-for-your.html">my SPOT device</a> allows me to send custom messages. The elevation chart reads right to left, as this was the direction of my trip. The direction can be changed for each trip.<br />
<br />
If you navigate around in the map, you'll see that the elevation chart is changing to reflect the view:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-TEfrn7tG81A/U_H5rr_odJI/AAAAAAAAMOA/E2xkEPmC1_I/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.02.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-TEfrn7tG81A/U_H5rr_odJI/AAAAAAAAMOA/E2xkEPmC1_I/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.02.18.png" /></a></div>
<br />
This is done using <a href="http://square.github.io/crossfilter/">Crossfilter</a> to quickly select the points within the map view, although my iPad gets a bit sluggish with instant updates while dragging. <br />
<br />
Instagram photos are displayed on the map using the great <a href="https://github.com/Leaflet/Leaflet.markercluster">Leaflet.markercluster</a> plugin:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-OOW6H-suWAA/U_H7c4wvFwI/AAAAAAAAMOM/6PegkzZIv9g/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.08.42.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-OOW6H-suWAA/U_H7c4wvFwI/AAAAAAAAMOM/6PegkzZIv9g/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.08.42.png" /></a></div>
<br />
<br />
The photos are shown in a lightbox where you can click/tap through the photos in a cluster (no swipe support yet):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-U0_mzlydz4E/U_H7tVz-O_I/AAAAAAAAMOU/IbD02oFU6Pg/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.12.21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-U0_mzlydz4E/U_H7tVz-O_I/AAAAAAAAMOU/IbD02oFU6Pg/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B15.12.21.png" height="630" width="640" /></a></div>
<br />
<br />
All elements are responsive and should adapt to different screen sizes. I've also made a build process with <a href="http://gruntjs.com/">Grunt</a> to concatenate and compress all the CSS and JavaScript into single files. <a href="http://lesscss.org/">LESS</a> are used to get rid of all the browser prefixes in CSS. I also made a <a href="https://github.com/mbostock/smash/wiki">custom build of D3.js</a> to only include the bits I used, reducing the size to one third.<br />
<br />
Continuing the work when there are new trips coming up!</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4741970181714760187.post-28672012341090697372014-07-30T10:22:00.000+01:002014-08-18T15:05:09.120+01:00Live tracking from Oslo to Bergen by foot - ready for takeoff!<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<b>Update August 2: I had to cancel the trip on day 3 due to serious illness in close family.</b><br />
<br />
Follow the trip on: </div>
<div>
<ul style="text-align: left;">
<li><a href="http://oslobergen.no/">oslobergen.no</a></li>
<li><a href="https://www.facebook.com/groups/oslo.bergen">facebook.com/groups/oslo.bergen</a></li>
<li><a href="http://instagram.com/instanturban">instagram.com/instanturban</a></li>
</ul>
</div>
<div>
Tomorrow, Thursday 31 July, I'm starting on my four weeks hike from Oslo to Bergen. It's been a very nice and warm summer in Norway, so it's been hard to work on my real-time trekking map. But if everything works, you should be able to follow me <a href="http://oslobergen.no/">on this map</a>: </div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-pSX8Q23tMko/U_IH_RiNgVI/AAAAAAAAMO4/nNz_hIiS3A4/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B16.01.48.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-pSX8Q23tMko/U_IH_RiNgVI/AAAAAAAAMO4/nNz_hIiS3A4/s1600/Screen%2BShot%2B2014-08-18%2Bat%2B16.01.48.png" height="567" width="640" /></a></div>
<br />
[ <a href="http://oslobergen.no/">Fullscreen map</a> | <a href="https://github.com/turban/oslobergen">Code</a> ]</div>
<br />
<div>
The map shows the <a href="http://blog.thematicmapping.org/2014/06/real-time-satellite-tracking-for-your.html">real-time position sent from my SPOT device</a> and - </div>
<div>
<ul style="text-align: left;">
<li><a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">Place name, altitude and terrain types fetched from the the Norwegian Mapping Authority</a>.</li>
<li><a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">Weather forecast for the specific time and position</a>.</li>
<li><a href="http://blog.thematicmapping.org/2014/06/showing-instagram-photos-and-videos-on.html">Instagram photos along the way.</a> </li>
<li>Real-time elevation profile. </li>
<li>Sortable table of all recorded positions. </li>
<li>GPS track (in the map menu), more detailed than the SPOT track.</li>
</ul>
</div>
<div>
I'll blog about the technicalities after the trip. The expedition code is available on GitHub under a GPL licence if you want to dig in: https://github.com/turban/oslobergen</div>
<div>
<br /></div>
<div>
A few notes: </div>
<div>
<ul style="text-align: left;">
<li><a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">All data is synced with CartoDB</a>. </li>
<li><a href="http://blog.thematicmapping.org/2014/06/real-time-tracking-with-spot-and-leafet.html">The map is of course made with Leaflet</a>. </li>
<li>I'm using <a href="https://github.com/darkskyapp/sphere-knn">sphere-knn</a> to quickly find the nearest position when you're hovering og clicking the track line.</li>
<li>I'm using <a href="http://square.github.io/crossfilter/">crossfilter</a> to quickly sync the map and the elevation profile. </li>
<li>The elevation profile is made with <a href="http://www.highcharts.com/">Highcharts</a>. </li>
<li>I'm able to upload GPS tracks (GPX) from my mobile phone with <a href="http://en.wikipedia.org/wiki/USB_On-The-Go">USB OTG</a>.</li>
<li>The user interface and grid is made with <a href="http://docs.sencha.com/extjs/5.0.0/">Ext JS 5</a>. Maybe not the smartest move, as it's a huge download for mobile devices. </li>
</ul>
<div>
Hope it's working! :-)</div>
</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-Ox6sWu9f_Ps/U9i205U2cII/AAAAAAAAL3o/C2n6h0DDbq4/s1600/bilde.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-Ox6sWu9f_Ps/U9i205U2cII/AAAAAAAAL3o/C2n6h0DDbq4/s1600/bilde.jpg" height="598" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Geek on hike</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4741970181714760187.post-14295230175935306052014-06-14T23:35:00.003+01:002014-06-26T23:24:00.653+01:00Testing real-time mapping on Sjernarøyane archipelago<div dir="ltr" style="text-align: left;" trbidi="on">
I was quite happy with the <a href="http://blog.thematicmapping.org/2014/06/testing-my-expedition-map-to.html">real-time map from the hike to Preikestolen</a> yesterday. There were some issues with the SPOT Satellite Messenger I'll write about later. First I want to make a second test on a biking trip to Sjernarøyane archipelago.<br />
<br />
We'll bring a normal GPS on the trip, to be able to check the accuracy of the SPOT Satellite Messenger.<br />
<div>
<br /></div>
<iframe frameborder="0" height="500px" src="http://turban.github.io/oslo-bergen/test/sjernaroy.html" width="100%"></iframe><br />
<div>
[ <a href="http://turban.github.io/oslo-bergen/test/sjernaroy.html">Fullscreen map</a> ]<br />
<br />
We'll start biking about 9:15 am (Central European Summer Time) Sunday June 15th. New positions should appear on the map as we bike (every 5 minutes), but you still need to refresh the page to get new Instagram photos.<br />
<br />
<h3 style="text-align: left;">
Update: Test results</h3>
I'm much more satisfied with the performance of my SPOT Satellite Messenger on this trip. I brought with me a Garmin GPS to get the full track of the biking trip, and it's shown as a blue line on the map.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-CHP_WPD15xU/U59gB6Fq97I/AAAAAAAALZU/pjoYZtH6elw/s1600/Screen+Shot+2014-06-16+at+23.18.09.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-CHP_WPD15xU/U59gB6Fq97I/AAAAAAAALZU/pjoYZtH6elw/s1600/Screen+Shot+2014-06-16+at+23.18.09.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The track shows an overlap between the SPOT positions and the Garmin GPS.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><br />
<a href="http://4.bp.blogspot.com/-qRScPBgH0jI/U59gik028yI/AAAAAAAALZc/beJAfrKW440/s1600/Screen+Shot+2014-06-16+at+23.24.02.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-qRScPBgH0jI/U59gik028yI/AAAAAAAALZc/beJAfrKW440/s1600/Screen+Shot+2014-06-16+at+23.24.02.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Automatically retrieving place name, terrain type, altitude and weather works. <br />
The weather forecast is not always correct, but quite good! </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-zz2g7VNEFZc/U59hi0QsDzI/AAAAAAAALZo/_b_LYTgXs2c/s1600/Screen+Shot+2014-06-16+at+23.26.29.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-zz2g7VNEFZc/U59hi0QsDzI/AAAAAAAALZo/_b_LYTgXs2c/s1600/Screen+Shot+2014-06-16+at+23.26.29.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Not all Instagram photos are correctly positioned. <br />
I will try to turn on the phone GPS if the mobile coverage is poor.</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-FYVcKYcKMqc/U59iMdaUQaI/AAAAAAAALZw/mMB-rjtUbuI/s1600/Screen+Shot+2014-06-16+at+23.30.56.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-FYVcKYcKMqc/U59iMdaUQaI/AAAAAAAALZw/mMB-rjtUbuI/s1600/Screen+Shot+2014-06-16+at+23.30.56.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The maps looks crowded with many photos. I'll try to adjust the thumbnail size.</td></tr>
</tbody></table>
<br />
Overall, quite happy with the test results! :-)</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4741970181714760187.post-21703168371182264052014-06-12T16:40:00.001+01:002014-06-16T22:54:25.595+01:00Testing my real-time expedition map to Preikestolen<div dir="ltr" style="text-align: left;" trbidi="on">
In my previous blog posts, I've worked on the various parts of an expedition map that I plan to use on a <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-from-oslo-to-bergen.html">4-weeks hike between Oslo in Bergen</a>. Now I'm ready for a test run. Tomorrow Friday, I'm leaving the island for a hike up to <a href="http://en.wikipedia.org/wiki/Preikestolen">Preikestolen</a>.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-wM2hG_2wAII/U5nJN72ichI/AAAAAAAALYU/R613pMr7ZHE/s1600/Picture+057.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-wM2hG_2wAII/U5nJN72ichI/AAAAAAAALYU/R613pMr7ZHE/s1600/Picture+057.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">From one of my previous trips to Preikestolen. </td></tr>
</tbody></table>
<br />
It's a short but scenic hike, just 4 km each way. It should be sufficient to test if the various parts of the my live tracking map:<br />
<ul style="text-align: left;">
<li><a href="http://blog.thematicmapping.org/2014/06/real-time-tracking-with-spot-and-leafet.html">Showing real-time positions from my SPOT Satellite Messenger</a>.</li>
<li><a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">Show the altitude and placename for each position, using an external API</a>. </li>
<li><a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">Showing the weather at each position, fetched from api.yr.no</a>. </li>
<li><a href="http://blog.thematicmapping.org/2014/06/showing-instagram-photos-and-videos-on.html">Showing Instagram photos and videos as we walk</a>. </li>
</ul>
<div>
If you have nothing smart to do, and if everything works, you can follow us on this map from around 11 AM tomorrow (Central European Summer Time), Friday June 13th. </div>
<div>
<br /></div>
<iframe frameborder="0" height="500px" src="http://turban.github.io/oslo-bergen/test/preikestolen.html" width="100%"></iframe><br />
<div>
[ <a href="http://turban.github.io/oslo-bergen/test/preikestolen.html">Fullscreen map</a> ]<br />
<br />
New positions should appear on the map as we walk (every 5 minutes), but you need to refresh the page to get new Instagram photos.<br />
<br />
<h3 style="text-align: left;">
Update: Test results</h3>
I was not too impressed with the performance of my SPOT Satellite Messenger on this trip.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-9ruiz5ynYsg/U59YskmwC9I/AAAAAAAALYs/sGPubI2SuOg/s1600/Screen+Shot+2014-06-16+at+22.50.23.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-9ruiz5ynYsg/U59YskmwC9I/AAAAAAAALYs/sGPubI2SuOg/s1600/Screen+Shot+2014-06-16+at+22.50.23.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The tent marker (placed by clicking on the custom message button) is correctly located, <br />
but the time, and thereby the dotted line, is wrong. <br />
It seems to be because of dense woods where i pushed the button, <br />
and the time recorded is when it's received and not when the button is pushed. <br />
Note to self: Don't use the buttons while walking. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-BmYfjShCCyk/U59ahr8UFJI/AAAAAAAALY4/BmJulLUYOSE/s1600/Screen+Shot+2014-06-16+at+22.58.03.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-BmYfjShCCyk/U59ahr8UFJI/AAAAAAAALY4/BmJulLUYOSE/s1600/Screen+Shot+2014-06-16+at+22.58.03.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Luckily, I didn't fall off the cliff as the map indicates, so that position is clearly wrong. <br />
Note to self: Turn off tracking while stopping at a location, especially when making "strange moves". <br />
Note to self II: Tell family and friends that they should rely 100% on what they see on the map.... </td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><br />
<a href="http://3.bp.blogspot.com/-HVDt7s9knYo/U59b5QXeVfI/AAAAAAAALZA/9GoHKD6U-Us/s1600/Screen+Shot+2014-06-16+at+23.04.06.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-HVDt7s9knYo/U59b5QXeVfI/AAAAAAAALZA/9GoHKD6U-Us/s1600/Screen+Shot+2014-06-16+at+23.04.06.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The SPOT stopped tracking at the bottom right position, <br />
and I got no positions before we reached the end (by the photos). <br />
It's a bit strange because it had no difficulties in tracking the start of the trip - in a similar terrain. <br />
Note to self: Make sure the SPOT is in a visible positions on the top of my backpack. <br />
The density of the tracking points will vary in dense woods and/or steep terrain.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-2wlNLIPQT0k/U59dAZYcHZI/AAAAAAAALZI/NPkfDb1DnKg/s1600/Screen+Shot+2014-06-16+at+23.08.43.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-2wlNLIPQT0k/U59dAZYcHZI/AAAAAAAALZI/NPkfDb1DnKg/s1600/Screen+Shot+2014-06-16+at+23.08.43.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Most were, but not all Instagram photos were correctly positioned. <br />
The photo above should be by the tent marker, but is a few km further west. <br />
As the SPOT was also struggling here, I guess it's due to poor mobile coverage. </td></tr>
</tbody></table>
<br />
See also comments.<br />
<br />
Bonus material: A <a href="http://blog.thematicmapping.org/2014/01/photo-spheres-with-threejs.html">photo sphere</a> from Preikestolen :-)<br />
<br />
<iframe frameborder="0" height="500" src="http://turban.github.io/photosphere/preikestolen.html" width="100%"></iframe>
[ <a href="http://turban.github.io/photosphere/preikestolen.html">Fullscreen</a> ]
<br /></div>
</div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-4741970181714760187.post-22742076583414770522014-06-12T15:01:00.003+01:002014-06-26T23:32:38.731+01:00Showing Instagram photos and videos on a Leaflet map<div dir="ltr" style="text-align: left;" trbidi="on">
I've created a new plugin, <a href="https://github.com/turban/Leaflet.Instagram">Leaflet.Instagram</a>, that allows you to add Instagram photos and videos to your maps. You can load photos with the <a href="http://instagram.com/developer/">Instagram API</a> or from <a href="https://cartodb.com/">CartoDB</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-wB2V8hcIsHw/U6yeKN1wREI/AAAAAAAALaQ/qdVGQnr0zCk/s1600/Screen+Shot+2014-06-26+at+20.32.25.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-wB2V8hcIsHw/U6yeKN1wREI/AAAAAAAALaQ/qdVGQnr0zCk/s1600/Screen+Shot+2014-06-26+at+20.32.25.png" height="574" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can choose to show your images in a popup or a lightbox. The small images on the map can be clustered. </td></tr>
</tbody></table>
<br />
The plugin is very easy to use:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">L.instagram('https://api.instagram.com/v1/users/209969753/media/recent?access_token=<i>your_access_token</i>').addTo(map);</span><br />
<br />
Just add the url and <a href="http://instagram.com/developer/endpoints/">endpoint</a> to the Leaflet API together with your <a href="http://instagram.com/developer/authentication/">access token</a>. If you don't want to expose you're access token, I suggest that you create a proxy or <a href="http://blog.thematicmapping.org/2014/06/syncing-your-instagram-photos-to-cartodb.html">sync your data with CartoDB</a>. The plugin has built-in support for CartoDB:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">L.instagram('http://turban.cartodb.com/api/v2/sql?q=SELECT * FROM instagram WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(5.952, 59.329), ST_Point(5.982, 59.342)), 4326)').addTo(map); </span><br />
<div>
<br /></div>
<div>
Using CartoDB has the added benefit of allowing a wide range of spatial queries. In the query above I'm only fetching images within the geographic bounds of the island. </div>
<div>
<br /></div>
<div>
The interactive map looks like this (try it in fullscreen!):</div>
<div>
<br /></div>
<iframe frameborder="0" height="500px" src="http://turban.github.io/Leaflet.Instagram/examples/popup-cluster.html" width="100%"></iframe><br />
<div>
[ <a href="http://turban.github.io/Leaflet.Instagram/examples/popup-cluster.html">Fullscreen map</a> | <a href=https://github.com/turban/Leaflet.Instagram/blob/gh-pages/examples/popup-cluster.html">Code</a> ]</div>
<div>
<br /></div>
<div>
Click on a image to see a bigger version or to play a video. </div>
</div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-4741970181714760187.post-239579218109685262014-06-11T16:05:00.001+01:002014-06-11T16:20:04.315+01:00Syncing your Instagram photos to CartoDB<div dir="ltr" style="text-align: left;" trbidi="on">
I really want to show photos on <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-from-oslo-to-bergen.html">my expedition map</a>. Instead of creating my own photo service, I want to use a service that already support geotagged photos, <a href="http://instagram.com/">Instagram</a>. To get more control, I'm syncing the metadata for my photos and videos to my <a href="https://cartodb.com/">CartoDB</a>-account using the <a href="http://instagram.com/developer/">Instagram API</a>.<br />
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-AYbq6AUcU7k/U5hvzQUb4nI/AAAAAAAALXk/dIHULmNr3HM/s1600/Screen+Shot+2014-06-11+at+17.03.09.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-AYbq6AUcU7k/U5hvzQUb4nI/AAAAAAAALXk/dIHULmNr3HM/s1600/Screen+Shot+2014-06-11+at+17.03.09.png" height="546" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CartoDB-map showing Instagram photos.</td></tr>
</tbody></table>
<br />
Please read the <a href="http://instagram.com/about/legal/terms/api/">API Terms of Use</a> before you start doing this. You shall not <i>"cache or store any User Content other than for reasonable periods in order to provide the service you are providing to Instagram users"</i>. Here I'm only syncing textual data from my own user on Instagram. You can also show your Instagram photos on a map, using the Instagram API directly, as I will show in my next blog post. </div>
<div>
<br /></div>
<div>
I've created a PHP cron job, <a href="https://github.com/turban/oslo-bergen/blob/gh-pages/server/instagram2cartodb.php">instagram2cartodb.php</a>, that will sync my photos and videos to CartoDB:</div>
<div>
<br /></div>
<div>
<script src="http://gist-it.appspot.com/github/turban/oslo-bergen/blob/gh-pages/server/instagram2cartodb.php"></script>
</div>
<div>
<br /></div>
<div>
The script will read the latest images from an Instagram user using an access token. It also reads the latest timestamp from the CartoDB-table, to check which images are newer. I'm only storing geotagged images and videos, as I want to show these on a map.<br />
<br />
I've created a CartoDB map of my photos from Foldøy island using this <a href="http://blog.cartodb.com/post/43394168988/introducing-beautiful-info-windows-with-image-support">short tutorial on info-windows with image support</a>: </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<iframe allowfullscreen="" frameborder="0" height="400" mozallowfullscreen="" msallowfullscreen="" oallowfullscreen="" src="//turban.cartodb.com/viz/b72b4c3c-f177-11e3-b200-0e230854a1cb/embed_map?title=false&description=false&search=false&shareable=false&cartodb_logo=true&layer_selector=false&legends=false&scrollwheel=true&fullscreen=true&sublayer_options=1&sql=&sw_lat=59.32889896147948&sw_lon=5.924806594848633&ne_lat=59.34728285496197&ne_lon=6.009435653686523" webkitallowfullscreen="" width="100%"></iframe></div>
<div>
[ <a href="http://cdb.io/1lnjUAb">Fullscreen map</a> ]</div>
<div>
<br />
In the next blog post, we'll put our Instagram photos on a custom Leaflet map.</div>
<div>
</div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4741970181714760187.post-36746861557419276932014-06-11T13:58:00.002+01:002014-06-11T14:28:26.882+01:00How is the weather at this latitude, longitude location? <div dir="ltr" style="text-align: left;" trbidi="on">
In <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-finding-name-and.html">my last blog post</a>, we saw how to find the name and altitude of a latitude, longitude location. Today, I want to see what the weather is like. In Norway, we have a great free weather service, <a href="http://yr.no/">yr.no</a>, that also comes with an API (with world coverage!). I'm going to use it to log the weather <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-from-oslo-to-bergen.html">on my expedition map</a>.<br />
<br />
<a href="http://om.yr.no/about/">yr.no is a joint weather service</a> from the Norwegian Meteorological Institute (<a href="http://met.no/">met.no</a>) and the Norwegian Broadcasting Corporation (<a href="http://nrk.no/">NRK</a>). yr.no is unique in Europe because of very detailed weather forecasts and <a href="http://om.yr.no/verdata/free-weather-data/">a free data policy</a>.<br />
<br />
I'm using the <a href="http://api.yr.no/weatherapi/locationforecast/1.9/documentation">location forecast API</a> (<a href="http://api.yr.no/license_data.html">terms of use</a>), which returns the weather forecast for a latitude, longitude location:<br />
<br />
<a href="http://api.yr.no/weatherapi/locationforecast/1.9/?lat=59.33895;lon=5.96639">http://api.yr.no/weatherapi/locationforecast/1.9/?lat=59.33895;lon=5.96639</a><br />
<br />
It returns an XML with a 9 days forecast starting from the current hour. I'm only logging the current time forecast for my expedition map.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-d-yNfmPOvZ8/U5hQGsU5EUI/AAAAAAAALXU/cyVDkuT8vcI/s1600/DSC04745.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-d-yNfmPOvZ8/U5hQGsU5EUI/AAAAAAAALXU/cyVDkuT8vcI/s1600/DSC04745.JPG" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I know it's totally useless, but this is my SPOT logging my current location so I can find the weather without looking up on the sky... </td></tr>
</tbody></table>
<br />
I've made a <a href="https://github.com/turban/oslo-bergen/blob/gh-pages/server/yr2cartodb.php">PHP cron job</a> that that adds weather data to <a href="http://blog.thematicmapping.org/2014/06/real-time-satellite-tracking-for-your.html">my SPOT Satellite Messenger locations</a>, that are already <a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">synced to CartoDB</a>. For these locations I already have the latitude, longitude and the time it was recorded.<br />
<br />
<script src="http://gist-it.appspot.com/github/turban/oslo-bergen/blob/gh-pages/server/yr2cartodb.php"></script>
<br />
I'm first asking for a full weather forecast from the API. Then I'm using<a href="http://www.php.net/manual/en/simplexmlelement.xpath.php"> XPath</a> to find the weather for the nearest hour. Data on temperature, precipitation, wind and the weather symbol is added to the CartoDB-table. I'm also calculating the <a href="http://www.php.net/manual/en/function.date-sunrise.php">sunrise</a> and <a href="http://www.php.net/manual/en/function.date-sunset.php">sunset</a> time to get the correct weather symbol (to show the sun or the moon).<br />
<br />
The weather data will be shown in the popups, and I'm going to play with the weather recordings after my expedition.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-1Qxe9wRX5Mk/U5hQz5TGOhI/AAAAAAAALXc/SWW04d4P6Ug/s1600/Screen+Shot+2014-06-11+at+14.50.07.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-1Qxe9wRX5Mk/U5hQz5TGOhI/AAAAAAAALXc/SWW04d4P6Ug/s1600/Screen+Shot+2014-06-11+at+14.50.07.png" height="540" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Showing the weather on the same location as the photo above. It's a bit chilly today with 14°C, sunny and a moderate breeze, 7 m/s from southwest - which is quite correct from my real-time experience :-) </td></tr>
</tbody></table>
<br />
So, we've enriched our satellite positions with location and weather data. But what would an expedition map be without photos? It's the topic of my next blog post. </div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4741970181714760187.post-790930446855115462014-06-06T13:54:00.002+01:002014-06-11T14:08:03.298+01:00Finding the name and altitude of your location<div dir="ltr" style="text-align: left;" trbidi="on">
If you know the latitude and longitude a location, how can you get additional information about the place? There are a lot of APIs and web services that will tell you. This blog post focuses on <a href="http://www.statkart.no/Kart/Gratis-kartdata/Hoydeprofil/">a web service</a> from <a href="http://www.kartverket.no/en/">the Norwegian Mapping Authority</a>, which will give you the name, altitude and terrain type of your location.<br />
<br />
In my previous blog posts (<a href="http://blog.thematicmapping.org/2014/06/real-time-satellite-tracking-for-your.html">1</a>, <a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">2</a>, <a href="http://blog.thematicmapping.org/2014/06/real-time-mapping-of-your-trip-with.html">3</a>, <a href="http://blog.thematicmapping.org/2014/06/real-time-tracking-with-spot-and-leafet.html">4</a>) I showed you how to use a SPOT Satellite Messenger to track your trips. This will give you a series of latitude and longitude points, and the time they where recorded, but that's about it. For <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-from-oslo-to-bergen.html">my expedition map</a>, I'm especially interested in the altitude of my location, which can be used to draw a height profile of the track. I would also like to show the name of the places I've been.<br />
<br />
Luckily, the <a href="http://www.kartverket.no/en/">Norwegian Mapping Authority</a> ("Kartverket") provides such a service with a great level of detail. The service allows you to send in a latitude/longitude position, and obtain the altitude, nearest place name and the terrain type. The service is described in Norwegian <a href="http://www.statkart.no/Kart/Gratis-kartdata/Hoydeprofil/">on this page</a>.<br />
<br />
Let's try with my current position:<br />
<ul style="text-align: left;">
<li>Latitude: 59.339</li>
<li>Longitude: 5.967</li>
</ul>
This URL will give you some facts about the place:<br />
<br />
<a href="http://openwps.statkart.no/skwms1/wps.elevation?request=Execute&service=WPS&version=1.0.0&identifier=elevation&datainputs=[lat=59.339;lon=5.967;epsg=4326]">http://openwps.statkart.no/skwms1/wps.elevation?request=Execute&service=WPS&version=1.0.0&identifier=elevation&datainputs=[<b>lat=59.339</b>;<b>lon=5.967</b>;epsg=4326]</a><br />
<br />
The <a href="http://en.wikipedia.org/wiki/Web_Processing_Service">WPS format</a> is quite verbose, but you should be able to parse out the data you need:<br />
<br />
<script src="http://gist-it.appspot.com/github/turban/oslo-bergen/blob/gh-pages/data/wps.elevation.xml"></script>
What does it tell me:<br />
<ul style="text-align: left;">
<li>I'm just 3.6 meters above sea level.</li>
<li>The terrain type is "Åpent område" (open area)</li>
<li>The nearest place name is "Norde Breivik"</li>
<li>The place id (SSRID) is 1196378. I can use this id to get <a href="http://faktaark.statkart.no/SSRFakta/faktaarkfraobjektid?enhet=1196378">more information about the place</a>.</li>
</ul>
Everything seems correct from where I'm sitting :-)<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-TEaLqAJQVjw/U5G3id8u7dI/AAAAAAAALWs/FkKdipxnkSo/s1600/DSC04568.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-TEaLqAJQVjw/U5G3id8u7dI/AAAAAAAALWs/FkKdipxnkSo/s1600/DSC04568.jpg" height="426" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Photo of my location from last evening.</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br /><br /><br /><br />
I've created <a href="https://github.com/turban/oslo-bergen/blob/gh-pages/server/kartverket2cartodb.php">a PHP script</a> to parse out the values from the XML. I'm running this script as a cron job to<br />
add information to the SPOT Satellite Messenger locations <a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">I already got in CartoDB</a>.<br />
<br />
<script src="http://gist-it.appspot.com/github/turban/oslo-bergen/blob/gh-pages/server/kartverket2cartodb.php"></script>
I'm then able to show information about the track in the popups:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-oImGEYqWwhI/U5G5xT5voAI/AAAAAAAALW8/ypIK_UkHsUg/s1600/Screen+Shot+2014-06-06+at+14.52.39.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-oImGEYqWwhI/U5G5xT5voAI/AAAAAAAALW8/ypIK_UkHsUg/s1600/Screen+Shot+2014-06-06+at+14.52.39.png" height="340" width="640" /></a></div>
<br />
<br />
In the next blog post, we'll <a href="http://blog.thematicmapping.org/2014/06/how-is-weather-at-this-latitude.html">add some weather information to our map</a>.</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-4741970181714760187.post-29663954279259239382014-06-05T05:26:00.000+01:002014-06-05T10:41:40.162+01:00Real-time tracking with SPOT and Leaflet<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
I've created a new plugin, <a href="https://github.com/turban/Leaflet.SpotTracker">Leaflet.SpotTracker</a>, that makes is super easy to add real-time tracking to your maps. The plugin displays tracking data directly from a <a href="http://www.findmespot.com/">SPOT Satellite Messenger</a>, or from <a href="https://cartodb.com/">CartoDB</a>.<br />
<br />
One line is enough if you're using <a href="http://faq.findmespot.com/index.php?action=showEntry&data=69">the SPOT API</a>:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">L.spotTracker('your_feed_id').addTo(map);</span><br />
<br />
This API has a request limit (500 requests within 15 minutes) and it will only fetch the last 50 messages from the last 7 days. I therefore recommend to <a href="http://blog.thematicmapping.org/2014/06/syncing-data-from-your-spot-satellite.html">sync your messages to CartoDB</a>, or similar storage options. You can also load tracking data from CartoDB with the plugin:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">L.spotTracker('your_feed_id', {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> api: 'http://turban.cartodb.com/api/v2/sql',</span><br />
<span style="font-family: Courier New, Courier, monospace;"> url: "{api}?q=SELECT * FROM spot WHERE feed_id='{feed}' ORDER BY timestamp"</span><br />
<span style="font-family: Courier New, Courier, monospace;">}).addTo(map);</span><br />
<br />
A few examples from <a href="http://blog.thematicmapping.org/2014/06/real-time-mapping-of-your-trip-with.html">my kayak trip around Foldøy island</a> (it will work better for <a href="http://blog.thematicmapping.org/2014/06/expedition-mapping-from-oslo-to-bergen.html">longer expeditions</a>):<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-9tcAXoBOWw0/U4_sI2W_O3I/AAAAAAAALWM/mSzE35gqTzw/s1600/foldoy1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-9tcAXoBOWw0/U4_sI2W_O3I/AAAAAAAALWM/mSzE35gqTzw/s1600/foldoy1.png" height="360" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The plugin will draw a line between all locations recorded, and you can style the line as you like.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-lxQPhN7Ezdo/U4_sI3CcaoI/AAAAAAAALV8/3ZqTt5oyN8U/s1600/foldoy2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-lxQPhN7Ezdo/U4_sI3CcaoI/AAAAAAAALV8/3ZqTt5oyN8U/s1600/foldoy2.png" height="360" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can add clickable dots or markers for each location.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-1i2d31IsBTg/U4_sI8rpi9I/AAAAAAAALWA/C3b1Qk-VSN0/s1600/foldoy3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-1i2d31IsBTg/U4_sI8rpi9I/AAAAAAAALWA/C3b1Qk-VSN0/s1600/foldoy3.png" height="360" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Different message types can be styled differently. </td></tr>
</tbody></table>
<br />
A pulsing marker will show where you currently are:<br />
<br />
<iframe frameborder="0" height="360px" src="http://turban.github.io/oslo-bergen/track/?feed=0pGqOT43h6tTRcGJujqltqRYE3rHNu6db" width="100%"></iframe>
<br />
[ <a href="http://turban.github.io/oslo-bergen/track/?feed=0pGqOT43h6tTRcGJujqltqRYE3rHNu6db">Fullscreen map</a> | <a href="https://github.com/turban/oslo-bergen/blob/gh-pages/track/index.html">Code</a> ]<br />
<br />
This is the first version of the <a href="https://github.com/turban/Leaflet.SpotTracker">Leaflet.SpotTracker</a> plugin. Please <a href="https://github.com/turban/Leaflet.SpotTracker/issues">report any issues you might have on GitHub</a>.</div>
</div>
Unknownnoreply@blogger.com2