-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
126 lines (82 loc) · 7.86 KB
/
atom.xml
File metadata and controls
126 lines (82 loc) · 7.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Devork]]></title>
<link href="http://devork.github.com/atom.xml" rel="self"/>
<link href="http://devork.github.com/"/>
<updated>2013-01-08T23:58:24+00:00</updated>
<id>http://devork.github.com/</id>
<author>
<name><![CDATA[Alex Davies-Moore]]></name>
<email><![CDATA[hello@devork.com]]></email>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Openlayers and Ordnance Survey OpenSpaces]]></title>
<link href="http://devork.github.com/blog/2012/10/06/openlayers-and-ordnance-survey-openspaces/"/>
<updated>2012-10-06T11:54:00+01:00</updated>
<id>http://devork.github.com/blog/2012/10/06/openlayers-and-ordnance-survey-openspaces</id>
<content type="html"><![CDATA[<p>The current implementation of OpenSpaces uses a very old version of <a href="http://openlayers.org/" title="OpenLayers">OpenLayers</a>: so old that most of the awesome cool mobile stuff isn’t present. To rectify this, I’ve posted a load of sample code to a <a href="https://github.com/devork/openspaces">GitHub</a> project that shows how to use OpenLayers with Ordnance Survey OpenSpaces.</p>
<!-- more -->
<p>What’s in the bundle?</p>
<p><code>tools</code> : set of scripts to get the latest Openlayers, Proj4 and the dark OL theme<br/>
<code>src</code> : the demo code - simple HTML app that displays a map.</p>
<p>Have fun and let me now if you get any probs/find it useful etc.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Hillshading with Ordnance Survey Panorama Data]]></title>
<link href="http://devork.github.com/blog/2012/09/01/hillshading-with-ordnance-survey-panorama-data/"/>
<updated>2012-09-01T15:27:00+01:00</updated>
<id>http://devork.github.com/blog/2012/09/01/hillshading-with-ordnance-survey-panorama-data</id>
<content type="html"><![CDATA[<p>This is a guide to creating some nice hillshaded GeoTIFFs using the Ordnance Survey Panorama Opendata. This example will run through a single tile of data — in this case SZ which contains some nice hills plus coastline. Throughout this guide we’ll be using EPSG:27700 as the SRS but obviously, others can be used (for Google Maps et al - EPSG:3857). All data can be downloaded from the <a href="https://www.ordnancesurvey.co.uk/opendatadownload/products.html">Ordnance Survey website</a>.</p>
<!-- more -->
<p>For this recipe, you will need the following:</p>
<ul>
<li>The Vector Map District SZ land data shape file - SZ_Land.shp</li>
<li>The OS Panorama datasets for SZ</li>
</ul>
<p>Firstly, from Panorama, create some initial GeoTiffs from the ESRI ASCII files, for example:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>gdal_translate -a_srs EPSG:27700 sz88.asc sz88.tiff
</span></code></pre></td></tr></table></div></figure>
<p>The following bash script will do the lot in one directory:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">for </span>i in <span class="sb">`</span>ls *asc<span class="sb">`</span>; <span class="k">do </span>gdal_translate -a_srs EPSG:27700 <span class="nv">$i</span> <span class="nv">$i</span>.tiff ; <span class="k">done</span>
</span></code></pre></td></tr></table></div></figure>
<p>Now we merge the tiffs into one single image:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">TIFFS</span><span class="o">=</span><span class="s1">''</span>
</span><span class='line'><span class="k">for </span>i in <span class="sb">`</span>ls *.tiff<span class="sb">`</span>; <span class="k">do </span><span class="nv">TIFFS</span><span class="o">=</span><span class="s2">"$i "</span><span class="nv">$TIFFS</span> ; <span class="k">done</span>
</span><span class='line'>gdal_merge.py -o merged.tiff <span class="nv">$TIFFS</span>
</span></code></pre></td></tr></table></div></figure>
<p>At this point, you can open up the tiff to see something not very interesting, but you should be able to see stuff. If you open in an image editor, be careful not to save it back as it overwrite the geo information stored in the metadata.</p>
<p>The next step is to do some data resampling (<a href="http://alastaira.wordpress.com/2011/07/20/creating-hill-shaded-tile-overlays/">Creating Hillshaded Tile Overlays</a>)</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>gdalwarp <span class="se">\ </span>
</span><span class='line'> -dstnodata 0 <span class="se">\</span>
</span><span class='line'> -tr 7 7 <span class="se">\</span>
</span><span class='line'> -r cubicspline <span class="se">\</span>
</span><span class='line'> -multi -co <span class="s2">"TILED=YES"</span> <span class="se">\</span>
</span><span class='line'> merged.tiff merged.res.tiff
</span></code></pre></td></tr></table></div></figure>
<p>Once we’ve created the higher resolution data, we run the hillshade</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>gdaldem hillshade merged.res.tiff merged.res.hs.tiff
</span></code></pre></td></tr></table></div></figure>
<p>You can now open the new tiff and see some lovely hillshading, although, we still need to remove the sea from the result. We do this by clipping to the coastline using our shape file (<a href="http://www.mikejcorey.com/wordpress/2011/02/05/tutorial-create-beautiful-hillshade-maps-from-digital-elevation-models-with-gdal-and-mapnik/">Create beautiful hillshade maps from digital elevation models with GDAL and Mapnik</a>).</p>
<p>First off, we get the extent of the shapefile:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>ogrinfo -al SZ_Land.shp
</span></code></pre></td></tr></table></div></figure>
<p>And using the extent info (for SZ should look like Extent: (400000.000000, 75255.528637) - (499024.062190, 100000.000000)) we trim the tiff:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>gdal_translate <span class="se">\</span>
</span><span class='line'> -projwin 400000.000000 100000.000000 499024.062190 75255.528637 <span class="se">\</span>
</span><span class='line'> merged.res.hs.tiff merged.res.box.tiff
</span></code></pre></td></tr></table></div></figure>
<p>Be aware of the order for the -projwin parameter - its not the same as reported by the extent! It requires the NW -> SE points as opposed to SW -> NE.</p>
<p>And finally, the alpha and cropping:</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"></pre></td><td class='code'><pre><code class='bash'><span class='line'>gdalwarp <span class="se">\ </span>
</span><span class='line'> -dstalpha <span class="se">\</span>
</span><span class='line'> -srcnodata 0 <span class="se">\</span>
</span><span class='line'> -dstnodata 0 <span class="se">\</span>
</span><span class='line'> -cutline SZ_Land.shp <span class="se">\</span>
</span><span class='line'> -crop_to_cutline <span class="se">\</span>
</span><span class='line'> merged.res.box.tiff merged.res.hs.final.tiff
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
</feed>