~ubuntu-branches/ubuntu/saucy/gpsprune/saucy

« back to all changes in this revision

Viewing changes to debian/scripts/get-tiles.py

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2010-05-06 00:08:17 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100506000817-uxan1bazwz66g0q5
Tags: 10-1
* New upstream version
* debian/copyright:
  - updated to include new info about generated and binary files in
    tim/prune/function/srtm/
* debian/scripts/get-tiles.py added, can be used to re-generate
  tiles*.txt files (see debian/copyright)
* debian/rules:
  - added srtmtiles target; re-build the srtmtiles.dat binary file
    at build-time
  - added tim/prune/function/srtm/srtmtiles.dat to JH_JAR_EXTRA
* debian/patches/00-fix_readme_in_about.patch removed, merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# © 2010, David Paleino <dapal@debian.org>
 
5
#
 
6
# This script is released under the GNU General Public License, version 2.
 
7
 
 
8
from urllib2 import urlopen
 
9
import re
 
10
 
 
11
base = "http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/%s/"
 
12
regions = ["Eurasia", "North_America", "Australia", "Islands", "South_America", "Africa"]
 
13
 
 
14
for reg in regions:
 
15
    url = base % reg
 
16
    tiles = []
 
17
    for line in urlopen(url).readlines():
 
18
        if line.startswith("<li>"):
 
19
            match = re.match("^<li><.*> ([^>]*)<.*>", line)
 
20
            if match:
 
21
                tiles.append(match.group(1).replace(".hgt.zip", ""))
 
22
    f = open("tiles%s.txt" % (regions.index(reg)+1), "w")
 
23
    f.write('\n'.join([reg] + tiles))
 
24
    f.close()