<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,3 +4,4 @@ commit.msg
 database_pg.py
 POSTGIS
 MYSQL
+data/tile.csv</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -5,14 +5,10 @@ import sys
 import re
 from math import sqrt
 
-# Main functions
-
-def loadTile(filename):
-  srtm = gdal.Open('data/Eurasia/' + filename + '.hgt')
-  return gdal_array.DatasetReadAsArray(srtm)
+from read_data import loadTile, posFromLatLon
+from data import util
 
-def posFromLatLon(lat,lon):
-  return (lat * 360 + lon) * 1200 * 1200
+# Main functions
 
 def writeTileCsvFile(tile, lat0, lon0, top_row = 1, bottom_row = 1200, left_col = 0, right_col = 1199 ):
   # Calculate begin position
@@ -29,25 +25,6 @@ def writeTileCsvFile(tile, lat0, lon0, top_row = 1, bottom_row = 1200, left_col
 
   f.close() 
 
-def getLatLonFromFileName(name):
-  # Split up in lat and lon:
-  p = re.compile('[NSEW]\d*')
-  [lat_str, lon_str] = p.findall(name)
-
-  # North or south?
-  if lat_str[0] == &quot;N&quot;:
-    lat = int(lat_str[1:])
-  else: 
-    lat = -int(lat_str[1:])
-  
-  # East or west?
-  if lon_str[0] == &quot;E&quot;:
-    lon = int(lon_str[1:])
-  else: 
-    lon = -int(lon_str[1:])
-
-  return [lat,lon]
-
 if __name__ == '__main__':
   # We will only upload 1 tile to the Google App Engine. This will take quite 
   # a bit of time. For the offline data store, we will only &quot;upload&quot; the city 
@@ -55,8 +32,8 @@ if __name__ == '__main__':
   
   # For this we need tile N49E008. 
   name = &quot;N49E008&quot;
-  tile = loadTile(name)
-  [lat,lon] = getLatLonFromFileName(name)
+  tile = loadTile(&quot;Eurasia&quot;, name)
+  [lat,lon] = util.getLatLonFromFileName(name)
 
   if not (&quot;online&quot; in sys.argv or &quot;offline&quot; in sys.argv):
       print &quot;Online or offline?&quot;
@@ -74,7 +51,7 @@ if __name__ == '__main__':
       # So that 1813 records
       writeTileCsvFile(tile, lat, lon, row_top, row_bottom, col_left, col_right)
       print &quot;Now run this command to insert the data into your local datastore:&quot;
-      print &quot;/path/to/app-engine-sdk/bulkload_client.py --filename ../data/tile.csv --kind Altitude --url http://localhost:8080/load --batch_size 100 --cookie 'dev_appserver_login=test@example.com:True'&quot;
+      print &quot;/path/to/app-engine-sdk/tools/bulkload_client.py --filename data/tile.csv --kind Altitude --url http://localhost:8080/load --batch_size 100 --cookie 'dev_appserver_login=test@example.com:True'&quot;
 
   else:
       # Because the bulk upload script does not support resume, we will upload</diff>
      <filename>import-google-app-engine.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8449fdf1f1435436f9b4909c8290082198f21379</id>
    </parent>
  </parents>
  <author>
    <name>sjors</name>
    <email>sjors@b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</email>
  </author>
  <url>http://github.com/Sjors/srtm2postgis/commit/5f0691a5d071897ec24c79ba53fa6a70682ac1e6</url>
  <id>5f0691a5d071897ec24c79ba53fa6a70682ac1e6</id>
  <committed-date>2008-07-30T23:23:40-07:00</committed-date>
  <authored-date>2008-07-30T23:23:40-07:00</authored-date>
  <message>Shared some common functionality of Postgres and App Engine import scripts.


git-svn-id: http://svn.openstreetmap.org/applications/utils/srtm2postgis/trunk@9395 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</message>
  <tree>a73a53c7e4b6b09a9fea925957619a16e90b29da</tree>
  <committer>
    <name>sjors</name>
    <email>sjors@b9d5c4c9-76e1-0310-9c85-f3177eceb1e4</email>
  </committer>
</commit>
