Skip to content

Commit

Permalink
Remove slice_language_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jirik committed Nov 10, 2017
1 parent ac81d0c commit 838ebbd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion checklist.chk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
6bc6dd86fedb960398b5d38e35af89fb ./testbuild/testmaptiles.tm2source/data.yml
d712def4ed07ad7a5d7173a3572acc73 ./testbuild/mapping.yaml
23aed4458497e8f0d794ddb6d5a02b42 ./testbuild/tileset.sql
da380515eacff2c557cd753aa66018ba ./testbuild/tileset.sql
2bbb5f07cf224ce595b7e6863bbbeac4 ./testbuild/doc/housenumber.md
1023bb8893f5bd1077a0376d5c0c4e5d ./testbuild/sqlquery.sql
321ae45757024c5b7b7d46714a2f17f6 ./testbuild/devdoc/etl_housenumber.dot
21 changes: 0 additions & 21 deletions openmaptiles/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
def collect_sql(tileset_filename):
tileset = Tileset.parse(tileset_filename)
sql = ''

definition = tileset.definition
languages = map(lambda l: str(l), definition.get('languages', []))
sql += get_slice_language_tags(languages)

for layer in tileset.layers:
sql += layer_notice(layer['layer']['id'])
for schema in layer.schemas:
Expand All @@ -21,19 +16,3 @@ def collect_sql(tileset_filename):

def layer_notice(layer_name):
return "DO $$ BEGIN RAISE NOTICE 'Layer {0}'; END$$;".format(layer_name)

SLICE_LANGUAGE_TAGS_SQL="""CREATE OR REPLACE FUNCTION slice_language_tags(tags hstore)
RETURNS hstore AS $$
SELECT delete_empty_keys(slice(tags, ARRAY[{0}]))
$$ LANGUAGE SQL IMMUTABLE;
"""

def get_slice_language_tags(languages):
include_tags = list(map(lambda l: 'name:'+l, languages))
include_tags.append('int_name')
include_tags.append('loc_name')
include_tags.append('name')

tags_sql = "'" + "', '".join(include_tags) + "'"

return SLICE_LANGUAGE_TAGS_SQL.format(tags_sql)

0 comments on commit 838ebbd

Please sign in to comment.