<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Weekly update route altitude profile</title>
	<atom:link href="http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/feed/" rel="self" type="application/rss+xml" />
	<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/</link>
	<description>All about me</description>
	<lastBuildDate>Wed, 21 Jul 2010 12:55:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Sjors</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1248</link>
		<dc:creator>Sjors</dc:creator>
		<pubDate>Tue, 05 Aug 2008 23:55:41 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1248</guid>
		<description>There seems to be some sort of weird issue with their FTP lately. Try the following link:

ftp://e0srp01u.ecs.nasa.gov/../srtm/version2/SRTM3/

You would have to change the &quot;.gov/srtm&quot; part in my download script to &quot;&quot;.gov/../srtm&quot;:
http://github.com/Sjors/srtm2postgis/</description>
		<content:encoded><![CDATA[<p>There seems to be some sort of weird issue with their FTP lately. Try the following link:</p>
<p><a href="ftp://e0srp01u.ecs.nasa.gov/../srtm/version2/SRTM3/" rel="nofollow">ftp://e0srp01u.ecs.nasa.gov/../srtm/version2/SRTM3/</a></p>
<p>You would have to change the &#8220;.gov/srtm&#8221; part in my download script to &#8220;&#8221;.gov/../srtm&#8221;:<br />
<a href="http://github.com/Sjors/srtm2postgis/" rel="nofollow">http://github.com/Sjors/srtm2postgis/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1247</link>
		<dc:creator>Graham</dc:creator>
		<pubDate>Tue, 05 Aug 2008 21:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1247</guid>
		<description>Sjors,
Thank you for the advice.  I had a bit of trouble downloading the SRTM data, so I ended up getting it from a different source as 5deg GeoTIFF files.  To confuse me, the origin of these files is top left, not bottom left as the HGT files.

I have had a quick go at putting together a simple server to return the height of a particular point using this data - I read all of the files into arrays in memory (only the uk is covered, so you need to use positions like (54,-1) - it is then a simple matter of checking which file contains the required data point, and grabbing it from an array (I do not do interpolation yet, so it is not precise.
It should be visible to the outside world at http://maps.webhop.net:1281/ if you are interested.  The obscure port number is because it is a pure python server rather than running via apache, so I didn&#039;t want to use port 80.
My real intention is to accept a GPX file describing a route, and return an elevation profile of it - a job for tomorrow evening....

Graham.</description>
		<content:encoded><![CDATA[<p>Sjors,<br />
Thank you for the advice.  I had a bit of trouble downloading the SRTM data, so I ended up getting it from a different source as 5deg GeoTIFF files.  To confuse me, the origin of these files is top left, not bottom left as the HGT files.</p>
<p>I have had a quick go at putting together a simple server to return the height of a particular point using this data &#8211; I read all of the files into arrays in memory (only the uk is covered, so you need to use positions like (54,-1) &#8211; it is then a simple matter of checking which file contains the required data point, and grabbing it from an array (I do not do interpolation yet, so it is not precise.<br />
It should be visible to the outside world at <a href="http://maps.webhop.net:1281/" rel="nofollow">http://maps.webhop.net:1281/</a> if you are interested.  The obscure port number is because it is a pure python server rather than running via apache, so I didn&#8217;t want to use port 80.<br />
My real intention is to accept a GPX file describing a route, and return an elevation profile of it &#8211; a job for tomorrow evening&#8230;.</p>
<p>Graham.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjors</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1236</link>
		<dc:creator>Sjors</dc:creator>
		<pubDate>Fri, 01 Aug 2008 07:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1236</guid>
		<description>Hi Graham,

I have tried to explain it somewhat in the comments of the function posFromLatLon(lat,lon), but it could use a bit more clarification. 

There are several things going on in that function. First it finds the correct tile. Then it figures out where your coordinates are within that tile. This will probably not be directly on top of a data point, so in stead it will give you the four closest points and the distance towards these points. 

The application then fetches the altitude of these four points and performs bilinear interpolation. 

At bit more background about the index:

As you have guessed correctly I use a bigint to create a unique index for every SRTM data point. The original data set consists of lots of tiles, each of which is exactly 1 degree longitude by 1 degree latitude. 

Now here comes the more difficult part. Each tile has been given a name (e.g. &quot;N45E001.hgt.zip&quot;) that represents its bottom left (south west) corner. However the file itself reads like a book: it starts in the top left corner. So the first column of the last row is located at 45&#039; north and 1&#039; east and the first column of the first row is located at 46&#039; north and 1&#039; east.  

I have created an index such that the tile &quot;N00E00&quot; has index 0. Tiles are 1200 rows by 1200 columns, so the tile directly east of it (&quot;N00E01&quot;) starts at position 1200 * 1200 =1440000. The tile directly west of it starts at position -1440000. Since there 360 degrees of longitude, the next latitude starts at 1200 * 1200 * 360. 

Once you know where a tile starts, you just need to know that the tile content starts at the top left corner and reads like a book.</description>
		<content:encoded><![CDATA[<p>Hi Graham,</p>
<p>I have tried to explain it somewhat in the comments of the function posFromLatLon(lat,lon), but it could use a bit more clarification. </p>
<p>There are several things going on in that function. First it finds the correct tile. Then it figures out where your coordinates are within that tile. This will probably not be directly on top of a data point, so in stead it will give you the four closest points and the distance towards these points. </p>
<p>The application then fetches the altitude of these four points and performs bilinear interpolation. </p>
<p>At bit more background about the index:</p>
<p>As you have guessed correctly I use a bigint to create a unique index for every SRTM data point. The original data set consists of lots of tiles, each of which is exactly 1 degree longitude by 1 degree latitude. </p>
<p>Now here comes the more difficult part. Each tile has been given a name (e.g. &#8220;N45E001.hgt.zip&#8221;) that represents its bottom left (south west) corner. However the file itself reads like a book: it starts in the top left corner. So the first column of the last row is located at 45&#8242; north and 1&#8242; east and the first column of the first row is located at 46&#8242; north and 1&#8242; east.  </p>
<p>I have created an index such that the tile &#8220;N00E00&#8243; has index 0. Tiles are 1200 rows by 1200 columns, so the tile directly east of it (&#8220;N00E01&#8243;) starts at position 1200 * 1200 =1440000. The tile directly west of it starts at position -1440000. Since there 360 degrees of longitude, the next latitude starts at 1200 * 1200 * 360. </p>
<p>Once you know where a tile starts, you just need to know that the tile content starts at the top left corner and reads like a book.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1235</link>
		<dc:creator>Graham</dc:creator>
		<pubDate>Fri, 01 Aug 2008 05:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1235</guid>
		<description>Sjors,
Thank you for the pointer - I will have a look at reading the data files directly, but I think I will get your database method working first, so that I only break one thing at a time!
One thing I am curious about is what the &#039;position&#039; is in your database - it seems to be a bigint which is a combination of the lat and lon - is this effectively the position of the data point in the raster file?  I am struggling to understand what 
def posFromLatLon(lat,lon):
  return (lat * 360 + lon) * 1200 * 1200
does.
Could you give me a pointer please?

Cheers

Graham.</description>
		<content:encoded><![CDATA[<p>Sjors,<br />
Thank you for the pointer &#8211; I will have a look at reading the data files directly, but I think I will get your database method working first, so that I only break one thing at a time!<br />
One thing I am curious about is what the &#8216;position&#8217; is in your database &#8211; it seems to be a bigint which is a combination of the lat and lon &#8211; is this effectively the position of the data point in the raster file?  I am struggling to understand what<br />
def posFromLatLon(lat,lon):<br />
  return (lat * 360 + lon) * 1200 * 1200<br />
does.<br />
Could you give me a pointer please?</p>
<p>Cheers</p>
<p>Graham.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjors</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1234</link>
		<dc:creator>Sjors</dc:creator>
		<pubDate>Fri, 01 Aug 2008 01:52:13 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1234</guid>
		<description>Hi Graham,

Glad to hear that! 

In retrospect, a big binary file (or several) might have been a better approach for this project. I was surprised to see the per record overhead that using a database creates [0].

The good news is that I recently abstracted the database part. There is a class Database that has only one method: fetchAltitude(position). So if you are in the mood, you could write a class that accesses the data directly from a file and it should work fine with the rest of my code.

Michael Kosowsky from   http://www.heywhatsthat.com/
wrote C++ code to read the .hgt files directly rather than
through a database. 

[0] http://code.google.com/p/route-altitude-profile/issues/detail?id=1</description>
		<content:encoded><![CDATA[<p>Hi Graham,</p>
<p>Glad to hear that! </p>
<p>In retrospect, a big binary file (or several) might have been a better approach for this project. I was surprised to see the per record overhead that using a database creates [0].</p>
<p>The good news is that I recently abstracted the database part. There is a class Database that has only one method: fetchAltitude(position). So if you are in the mood, you could write a class that accesses the data directly from a file and it should work fine with the rest of my code.</p>
<p>Michael Kosowsky from   <a href="http://www.heywhatsthat.com/" rel="nofollow">http://www.heywhatsthat.com/</a><br />
wrote C++ code to read the .hgt files directly rather than<br />
through a database. </p>
<p>[0] <a href="http://code.google.com/p/route-altitude-profile/issues/detail?id=1" rel="nofollow">http://code.google.com/p/route-altitude-profile/issues/detail?id=1</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham</title>
		<link>http://sprovoost.nl/2008/07/29/weekly-update-route-altitude-profile/comment-page-1/#comment-1233</link>
		<dc:creator>Graham</dc:creator>
		<pubDate>Thu, 31 Jul 2008 20:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://sprovoost.nl/?p=90#comment-1233</guid>
		<description>Sjors,
I am glad that  I found this project you are working on - I was just going to sit down and write something very similar myself for a little route planning tool I have been working on.
I had been wondering how best to handle the SRTM data - whether to use a database as you have or just make a big binary file to use as a huge array to try to speed it up - I was worried that trying to do lots of queries (&quot;give me the nearest measured point to position X&quot;) as I traverse the route would thrash the database with such a huge dataset.  I thought I could make the big binary file idea work as the data is effectively a big grid of heights.
Do you find that Postgresql can cope alright with such a lot of data (and are you running it on a very serious computer? - I am trying to use a minimalist low power one - a 1GHz Via C7).

Cheers

Graham.</description>
		<content:encoded><![CDATA[<p>Sjors,<br />
I am glad that  I found this project you are working on &#8211; I was just going to sit down and write something very similar myself for a little route planning tool I have been working on.<br />
I had been wondering how best to handle the SRTM data &#8211; whether to use a database as you have or just make a big binary file to use as a huge array to try to speed it up &#8211; I was worried that trying to do lots of queries (&#8220;give me the nearest measured point to position X&#8221;) as I traverse the route would thrash the database with such a huge dataset.  I thought I could make the big binary file idea work as the data is effectively a big grid of heights.<br />
Do you find that Postgresql can cope alright with such a lot of data (and are you running it on a very serious computer? &#8211; I am trying to use a minimalist low power one &#8211; a 1GHz Via C7).</p>
<p>Cheers</p>
<p>Graham.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
