<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Scratching Surfaces &#187; Mountain Biking</title>
	<atom:link href="http://www.surfaces.co.il/category/biking/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.surfaces.co.il</link>
	<description>Open Source - GIS - Thoughts</description>
	<lastBuildDate>Wed, 22 May 2013 08:26:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Manipulating GPS tracks in Spatialite</title>
		<link>http://www.surfaces.co.il/manipulating-gps-tracks-in-spatialite/</link>
		<comments>http://www.surfaces.co.il/manipulating-gps-tracks-in-spatialite/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 20:13:41 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[Mountain Biking]]></category>
		<category><![CDATA[Spatialite]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1250</guid>
		<description><![CDATA[I returned from a short bike outing with my ride captured as a GPS track. Along the way, I also grabbed the rest stops as waypoints. Both of these were downloaded from the GPS as *.gpx files. So I have tracks.gpx and waypoints.gpx. Now I want to push these layers straight into Spatialite, and do some [...]]]></description>
				<content:encoded><![CDATA[<p>I returned from a short bike outing with my ride captured as a GPS track. Along the way, I also grabbed the rest stops as waypoints. Both of these were downloaded from the GPS as <a title="gpx" href="http://www.topografix.com/gpx.asp">*.gpx</a> files. So I have tracks.gpx and waypoints.gpx. Now I want to push these layers straight into Spatialite, and do some calculations.<br />
<span id="more-1250"></span></p>
<p>I pulled the data from my GPS using <a title="GPSBabel" href="http://www.gpsbabel.org/">gpsbabel</a> but you can also choose the Quantum GIS GPSTools plugin to download GPS data in GPX format. Now to move these layers straight into a Spatialite database I use the ogr2ogr utility. This is part of the GDAL toolset, the &#8220;Swiss Army Knife&#8221; of spatial data formats. It allows me to move vector data from one format to another, with several options to filter or alter the original data along the way.<br />
Here&#8217;s how I start:</p>
<p><code>$ ogr2ogr -f SQLite -nln ride -dsco "SPATIALITE=YES" -t_srs "EPSG:4326" bike_rides.sqlite bike_rides.gpx tracks</code></p>
<p>The first option sets the output format &#8216;<code>-f</code>&#8216; as SQLite. Next I use &#8216;<code>-nln</code>&#8216; to choose a &#8220;New Layer Name&#8221; for the table to be created. The &#8216;<code>-dsco</code>&#8216; options means &#8220;DataSet Create Option&#8221; and here we dictate Spatialite. The next flag &#8216;<code>-t_srs</code>&#8216; sets the spatial reference system for the data layer. While not strictly necessary (GPS data is always Lon/Lat WGS84) it&#8217;s a good policy to always set the SRS explicitly. Now pay attention to the order of the next parameters: the target database is first, and the source (gpx file) is second. This is backwards from many other command line tools. Normally we expect first the &#8220;from&#8221; followed by the &#8220;to&#8221;. For ogr2ogr it&#8217;s: &#8220;destination&#8221; first and &#8220;source&#8221; following. And finally at the end of the above command we choose to bring only GPS <code>tracks</code> into the database.</p>
<p>If our GPX file contains several tracks (perhaps from previous bike rides) we can filter those out with a simple -sql option such as:</p>
<p><code>$ ogr2ogr -f SQLite bike_rides.sqlite bike_rides.gpx -nln amazia_ride -dsco "SPATIALITE=YES" -sql "SELECT name, number FROM tracks WHERE name='Amazia-2' " tracks<br />
</code></p>
<p>Next, I need to get the stops along the way, which were captured as waypoints. Similar to above:</p>
<p><code>$ ogr2ogr -f SQLite bike_rides.sqlite waypoints.gpx -nln stops -append waypoints</code></p>
<p>Now, I don&#8217;t user the &#8216;-dsco&#8217; parameter since the database already exists. What&#8217;s more, I must specify &#8216;<code>-append</code>&#8216; to instruct ogr2ogr to <strong>add</strong> this layer as a new table in the existing sqlite database.</p>
<p>OK, how long was the whole ride? The built in Spatialite function GeodesicLength() calculates lengths of Lon/Lat features <strong>in meters</strong>, along the WGS84 ellipsoid.</p>
<p>spatialite&gt; SELECT GeodesicLength(r.Geometry) AS &#8220;Total Length&#8221; FROM ride AS r;<br />
Total Length<br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
9696.2803124924</p>
<p>But I want to know how much each section of the ride was. In other words, I want to see the accumulated distance at each of the stops. We have in spatialite a function ST_Line_Locate_Point() which returns the distance along a line feature for points near the line. (It actually finds the nearest point on the line for each of the input points). So we do:</p>
<p><code>spatialite&gt; SELECT s.name AS "Stop name",<br />
...&gt; ST_Line_Locate_Point(r.Geometry, s.Geometry) AS "Stop Locations"<br />
...&gt; FROM ride AS r, stops AS s<br />
...&gt; GROUP BY s.name ORDER BY s.OGC_FID;<br />
Stop name   Stop Locations<br />
----------  --------------<br />
start       0.0<br />
rest 1      0.124783450768<br />
water stop  0.361703783084<br />
rest 2      0.562004941906<br />
rest 3      0.712163267248<br />
overlook    0.850818111308<br />
end         0.996608235043<br />
</code></p>
<p>The <code>OGC_FID</code> field is automatically created by ogr2ogr as a <em>primary key</em>. So doing &#8220;<code>ORDER BY</code>&#8221; on that field insures that the stop points are displayed in the correct order. But the numbers above are not distances, but rather the <strong>fraction</strong> of the total line length where each point falls. Now multiplying these fractions by the total length from the first query above, I get:</p>
<p><code>spatialite&gt; SELECT s.name AS "Stop name",<br />
...&gt; ST_Line_Locate_Point(r.Geometry, s.Geometry)*GeodesicLength(r.Geometry) AS "Accumlulated Distances"<br />
...&gt; FROM ride AS r, stops AS s<br />
...&gt; GROUP BY s.name ORDER BY s.OGC_FID;<br />
Stop name   Accumlulated Distances<br />
----------  ----------------------<br />
start       0.0<br />
rest 1      1209.93531700926<br />
water stop  3507.18127087581<br />
rest 2      5449.35745373272<br />
rest 3      6905.3346675029<br />
overlook    8249.77090219153<br />
end         9663.3928087156</code></p>
<p><strong>Nice</strong>. One last step, let&#8217;s put these distances permanently into the &#8220;stops&#8221; table.</p>
<p><code>spatialite&gt; ALTER TABLE stops ADD COLUMN accum_dist float;<br />
spatialite&gt; UPDATE stops SET accum_dist=(SELECT<br />
...&gt; ST_Line_Locate_Point(r.Geometry, s.Geometry)*GeodesicLength(r.Geometry)<br />
...&gt; FROM tracks AS r, stops AS s<br />
...&gt; WHERE s.OGC_FID=stops.OGC_FID);</code></p>
<p>We use a subquery to UPDATE the stops table. Take note of the WHERE condition: the OGC_FID values from the stops table <strong>outside of the subquery</strong> must match the values from the same column inside the query.</p>
<p><code>spatialite&gt; SELECT name AS "Stop name",accum_dist AS "Accumulated Distance" FROM stops;<br />
Stop name Accumulated Distance<br />
---------- --------------------<br />
start       0.0<br />
rest 1      1209.93531700926<br />
water stop  3507.18127087581<br />
rest 2      5449.35745373272<br />
rest 3      6905.3346675029<br />
overlook    8249.77090219153<br />
end         9663.3928087156<br />
</code><br />
There we are: accumulated distances for waypoints along a GPS track.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/manipulating-gps-tracks-in-spatialite/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>My Acacia seedling</title>
		<link>http://www.surfaces.co.il/my-acacia-seedling/</link>
		<comments>http://www.surfaces.co.il/my-acacia-seedling/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 20:26:55 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[Acacia Trees]]></category>
		<category><![CDATA[Mountain Biking]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1106</guid>
		<description><![CDATA[Last week&#8217;s bike ride was out to the wadi where &#8220;my&#8221; acacia seedling is struggling to survive. I was very satisfied to see that, with the cool winter weather, the plant has become green and seems to be doing well. On my last visit, during the scorching summer months, the seedling looked totally dried out [...]]]></description>
				<content:encoded><![CDATA[<p>Last week&#8217;s bike ride was out to the wadi where &#8220;my&#8221; acacia seedling is struggling to survive. I was very satisfied to see that, with the cool winter weather, the plant has become green and seems to be doing well. On my last visit, during the scorching summer months, the seedling looked totally dried out and dead, and I wasn&#8217;t sure it would pull thru. We haven&#8217;t had any rainfall yet, just the lower temperature was enough to allow the plant to start growing again. These thorny buggers have eons of evolution behind them, so I guess they know how to deal with the arid season.  I&#8217;ll visit again later during the winter and take measurements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/my-acacia-seedling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Storks over the Arava</title>
		<link>http://www.surfaces.co.il/storks-over-the-arava/</link>
		<comments>http://www.surfaces.co.il/storks-over-the-arava/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 18:26:17 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[Israel]]></category>
		<category><![CDATA[Mountain Biking]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1103</guid>
		<description><![CDATA[This week&#8217;s morning bike ride took me west of the Arava highway along the trail called the &#8220;springs route&#8221;. I came across a small flock of storks &#8211; maybe 50-75 &#8211; still resting on a knoll, getting organized for today&#8217;s leg of their migration to Africa. As I approached, they lifted off and resettled further [...]]]></description>
				<content:encoded><![CDATA[<p>This week&#8217;s morning bike ride took me west of the Arava highway along the trail called the &#8220;springs route&#8221;. I came across a small flock of storks &#8211; maybe 50-75 &#8211; still resting on a knoll, getting organized for today&#8217;s leg of their migration to Africa. As I approached, they lifted off and resettled further from the trail. Later in the morning, as I came out of one of the canyons, I was surprised by one of those impressive sites we get only in the fall: those few storks were part of a huge flock circling overhead, looking for thermals to gain some free altitude before their day&#8217;s flight south. Hundreds, maybe more than a thousand of these majestic birds, moving around in chorus.<br />
It&#8217;s early September, a bit soon for large migrations. The Bedouins say that when the storks fly across earlier than usual, then Europe will be experiencing a severe winter.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/storks-over-the-arava/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>The Mashak-Hatzeva bike route</title>
		<link>http://www.surfaces.co.il/the-mashak-hatzeva-biking-route/</link>
		<comments>http://www.surfaces.co.il/the-mashak-hatzeva-biking-route/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 20:33:30 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[Acacia Trees]]></category>
		<category><![CDATA[Mountain Biking]]></category>

		<guid isPermaLink="false">http://my.arava.co.il/~micha/blog/?p=269</guid>
		<description><![CDATA[A great, challenging 30 km. ride. The kickstand version This routes takes you over barren hilltops and through typical Arava stream beds. You&#8217;ll have the chance to watch rock and cliff formations drift by, and to scan the whole panorama of the Northern Arava from atop one of the high ridges. The whole derailleur The [...]]]></description>
				<content:encoded><![CDATA[<p>A great, challenging 30 km. ride.</p>
<p><span style="text-decoration: underline;">The kickstand version</span></p>
<p>This routes takes you over barren hilltops and through typical Arava stream beds. You&#8217;ll have the chance to watch rock and cliff formations drift by, and to scan the whole panorama of the Northern Arava from atop one of the high ridges.</p>
<p><span style="text-decoration: underline;">The whole derailleur</span></p>
<p>The route as described is circular, beginning and ending at the Ein Hatzeva road stop.<br />
The trail begins right across the road from the gas station, passing to the left of the Bedouin camp and heading west and slightly south along Wadi Mashak. After about four kilometers you come to the &#8220;Springs Route&#8221; trail. (A large concrete block marks the entrance to an army firing zone, so this route is to be used only on weekends and holidays.)  You&#8217;ll cross the &#8220;Springs Route&#8221; road and continue west, on a less travelled path. Another kilometer or so will bring you to &#8220;Chameleon Rock&#8221; (my name). You&#8217;ll know it when you see it&#8230; Just past this rock the trail enters the narrower part of Wadi Mashak, and soon you&#8217;ll reach a fork. Taking the right hand branch, brings you to one of the springs, Ein Mashak, on the &#8220;Springs Route&#8221;.<br />
Now don&#8217;t expect an oasis flowing with clear water. This &#8220;spring&#8221; and all the others were once artesian, constantly bubbling up salty water, with dense reeds and some palm trees growing in the mud. But they all have been dry for some decades, leaving only the browned remains of the foliage that once grew there.<br />
Looking ahead and slightly to the left you&#8217;ll be able to make out the continuation of the road heading uphill.  (Another trail also continues to the right, past the dried spring and short-cuts back to the Springs Route, in case you&#8217;re having second thoughts). This first strenuous climb (by foot, for me) will take you to an altitude of +60 meters.  The road stop at Ein Hatzeva is at -145 meters (145 m. below sea level), so do the math&#8230;  When you get to the top, while catching your breath, be sure to turn around and take in the scenery.  On clear days, you can see as far north as the Dead Sea, and south beyond Sapir.</p>
<p>Now after climbing back into the saddle, you&#8217;ll glide downhill for a kilometer or so, cross an un-named wadi, and then take a left turn at the jeep road to begin the second ascent of this route. Alas, no rest for the weary.  You&#8217;ll climb, and climb, some by foot, and some peddling up to +160 m.  Once reaching the ridge, at about 13 kilometers from the start of the trip, you&#8217;ll find no trees or bushes at all, only rusted remains of some vehicles, apparently left by the army for training.  From this ridge, you&#8217;ll be able to view to the west the mountain range that borders the western side of Nahal Zin with it&#8217;s distinctive geological formations. And the canyon just below and to the west is Wadi Hatzeva.<br />
The road along the ridge bends to the south. Follow downhill for a short way, and keep your eye out on the right hand side for a sparsely traveled path which drops down a gully to the west. This path is almost a &#8220;single-track&#8221;.  At the bottom, turning to the right, you&#8217;ll be in Wadi Hatzeva. A short ride along the wadi will bring you past one of the &#8220;Oron&#8221; phosphate quarries.<br />
Wadi Hatzeva meanders northward then to the east, between sandstone cliffs for a pleasant downhill ride.  Acacia trees along the way offer a bit of shade for a rest and snack. After 5-6 kilometers, the wadi merges with another smaller, dry riverbed from the right.  At this point the trail climbs (just a bit), and carries on for about 2  kilometers till you reach another impressive vantage point, just before a short, steep drop. Taking in the view you&#8217;ll clearly see the communication towers at the Ein Hatzeva road stop, and the greenhouses beyond.  After riding down the steep descent, you&#8217;ll be at a second spring, Ein Tamid. From here it&#8217;s 15-20 minutes clear sailing back to the main road.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/the-mashak-hatzeva-biking-route/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Faran to Tsukim</title>
		<link>http://www.surfaces.co.il/faran-to-tsukim/</link>
		<comments>http://www.surfaces.co.il/faran-to-tsukim/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 19:17:00 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[Mountain Biking]]></category>

		<guid isPermaLink="false">http://my.arava.co.il/~micha/blog/?p=262</guid>
		<description><![CDATA[A pleasant 30 km. ride, suitable also for families. The kickstand version This route, from just south of Moshav Faran, takes you northward, crossing several wadis, and ends at the new settlement of Tsukim. Along the way a few connections back to the main Arava hiway allow you to start in the middle, or cut [...]]]></description>
				<content:encoded><![CDATA[<p>A pleasant 30 km. ride, suitable also for families.</p>
<p><span style="text-decoration: underline;">The kickstand version</span></p>
<p>This route, from just south of Moshav Faran, takes you northward, crossing several wadis, and ends at the new settlement of Tsukim. Along the way a few connections back to the main Arava hiway allow you to start in the middle, or cut out before getting to Tsukim, making this a very flexible choice for families.</p>
<p><span style="text-decoration: underline;">The whole derailleur</span></p>
<p>Beginning a few kilometers south of the entrance to Faran, the start of the trail is marked as the southern end of the &#8220;Springs route&#8221;. Ride in along a short flat stretch until you begin the climb into the &#8220;Eshet furrow&#8221;, the range of hills running east-west that separates the huge Paran river bed from the smaller wadis to the south. After the steep climb and drop into the furrow, carry on along the road until coming out just west of the greenhouses of Moshav Faran. After passing the fields, the road crosses the Paran, and goes straight north into Wadi Barak, then bends north-eastward. A few more kilometers along and a road splits off to the left. (If you continue straight for another kilometer or so, you&#8217;ll exit back at the main hiway).  This leftward fork soon begins several ascents and descents as it hits each of the wadis broadside. Of course, the higher the climbs the better the views.</p>
<p>Along the way there&#8217;s another road splitting off to the right (east) to return to the main hiway, and other paths going west, which circle aound some of the hills, and come into Wadi Ashosh from it&#8217;s far western end. Staying on the north-south path you&#8217;ll eventually come to the &#8220;Ashosh Ascent&#8221;, a very steep, rocky, but short drop from the ridge down into Wadi Ashosh. Jeep drivers use this ascent to practice breaking their axels&#8230; Now, <span style="text-decoration: underline;">don&#8217;t go down</span>, but rather turn around and backtrack 200 meters to the entrance to Wadi Zofar that winds north. This less travelled route is much nicer than the flat road thru Wadi Ashosh (although both routes end at the same place). This wadi Zofar swings back and forth for about 7-8 kilometers and comes out just west of Tsukim. This part of the ride is all downhill, but some stretches of the wadi step over rock ledges nearly a meter high, so make sure your helmet is fastened, and have fun. Once you get to Tsukim, it&#8217;s only another 2 kilometers thru the mouth of Wadi Ashosh out to the main hiway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/faran-to-tsukim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>
