Commit 92c7c784 authored by Eliot Blennerhassett's avatar Eliot Blennerhassett

Moved most of SQL into database generation SQL script

Precomputing the join allows much quicker startup of this script
parent 4603dbfc
......@@ -36,26 +36,25 @@ def generate_osmchange(dbfile, outdir,
ET.SubElement(node, "tag", k=k, v=v)
con = db.connect(dbfile)
cur = con.cursor()
q = '''
linz_addr.full_address_number as housenumber,
linz_addr.full_road_name as street,
X(linz_addr.geom) as x,
Y(linz_addr.geom) as y,
linz_addr.suburb_locality as s,
linz_addr.town_city as c
from linz_addr
left outer join osm_linz
on (osm_id = linz_addr.linz_id)
osm_linz.linz_id is NULL
and linz_addr.addr_type != "Water"
order by linz_addr.town_city, linz_addr.suburb_locality
if True:
q = '''select * from linz_not_osm'''
# Select subset by place
q = 'select * from places'
places = list(cur.execute(q))
place = places[2000]
if place[0] is None:
q = '''select * from linz_not_osm
where c is NULL and s="{1}"
q = '''select * from linz_not_osm
where c="{0}" and s="{1}"
rows = cur.execute(q)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment