Switch the OCitySMap API to an integer for the OSM id

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
stable
Thomas Petazzoni 2009-12-21 11:55:59 +01:00
rodzic cc2573067c
commit 94787d0a7d
2 zmienionych plików z 13 dodań i 9 usunięć

Wyświetl plik

@ -120,16 +120,20 @@ def main():
sys.stderr.write('ERROR: Invalid city bounding box!\n')
return 1
if options.city_name:
city_name = unicode(options.city_name.decode('utf-8'))
else:
city_name = None
try:
osmid = int(options.osmid)
except ValueError:
sys.stderr.write('ERROR: Invalid polygon OSM id!\n')
return 1
try:
renderer = OCitySMap(options.config_file, city_name, boundingbox,
options.osmid, options.language)
osmid, options.language)
except BaseOCitySMapError, e:
sys.stderr.write('ERROR: %s\n' % e)
return 1

Wyświetl plik

@ -342,8 +342,8 @@ class OCitySMap:
from planet_osm_polygon
where boundary='administrative' and
admin_level='8' and
osm_id='%s';""" % \
pgdb.escape_string(osmid))
osm_id=%d;""" % \
osmid)
records = cursor.fetchall()
if not records:
raise UnsufficientDataError, "Wrong OSM id!"
@ -425,8 +425,8 @@ class OCitySMap:
st_buildarea(way)), 4002))
from planet_osm_polygon
where boundary='administrative'
and admin_level='8' and osm_id='%s';""" % \
pgdb.escape_string(osmid))
and admin_level='8' and osm_id=%d;""" % \
osmid)
contour = cursor.fetchall()
return self.parse_city_contour(contour)
@ -606,7 +606,7 @@ class OCitySMap:
from planet_osm_line
join map_areas
on st_intersects(way, st_transform(geom, 900913))
left join cities_area_by_osmid on cities_area_by_osmid.osm_id='%s'
left join cities_area_by_osmid on cities_area_by_osmid.osm_id=%d
where trim(name) != '' and highway is not null
and case when cities_area_by_osmid.area is null
then
@ -617,7 +617,7 @@ class OCitySMap:
as foo
group by name
order by name;""" % \
pgdb.escape_string(osmid))
osmid)
sl = cursor.fetchall()