From b44db299400421dd4bd9508b2fe6f2870ada8f27 Mon Sep 17 00:00:00 2001 From: Komzpa Date: Wed, 5 Oct 2011 22:33:07 +0200 Subject: [PATCH] support for hstore with column maps --- src/komap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/komap.py b/src/komap.py index e82fbc9..9c5cc46 100644 --- a/src/komap.py +++ b/src/komap.py @@ -82,7 +82,9 @@ if options.osm2pgsqlstyle != "-": osm2pgsql_avail_keys[line[1]] = tuple(line[0].split(",")) -def escape_sql_column(name, type="way", asname = False): +def escape_sql_column(name, type="way", asname = False) + if name in mapped_cols: + return name # already escaped name = name.strip().strip('"') type = {'line':'way', 'area':'way'}.get(type,type) if type in osm2pgsql_avail_keys.get(name, ()) or not osm2pgsql_avail_keys: @@ -171,7 +173,7 @@ if options.renderer == "mapnik": columnmap["name"] = ("""COALESCE("name:en","int_name", replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(translate("name",'абвгдезиклмнопрстуфьАБВГДЕЗИКЛМНОПРСТУФЬ','abvgdeziklmnoprstuf’ABVGDEZIKLMNOPRSTUF’'),'х','kh'),'Х','Kh'),'ц','ts'),'Ц','Ts'),'ч','ch'),'Ч','Ch'),'ш','sh'),'Ш','Sh'),'щ','shch'),'Щ','Shch'),'ъ','”'),'Ъ','”'),'ё','yo'),'Ё','Yo'),'ы','y'),'Ы','Y'),'э','·e'),'Э','E'),'ю','yu'),'Ю','Yu'),'й','y'),'Й','Y'),'я','ya'),'Я','Ya'),'ж','zh'),'Ж','Zh')) AS name""",('name:en','int_name',)) elif locale: columnmap["name"] = ('COALESCE("name:'+locale+'", "name") AS name',('name:'+locale,)) - + mapped_cols = [i[0] for i in columnmap.values] numerics = set() # set of number-compared things, like "population<10000" needs population as number, not text mapniksheet = {}