icon layer grouping
This commit is contained in:
parent
2f77654a1e
commit
1acd506e28
1 changed files with 33 additions and 22 deletions
55
src/komap.py
55
src/komap.py
|
@ -326,32 +326,43 @@ for zoom, zsheet in mapniksheet.iteritems():
|
|||
else:
|
||||
xml_nolayer()
|
||||
for layer_type, entry_types in [("point", ("node", "point")),("line",("way", "line")), ("polygon",("way","area"))]:
|
||||
for zindex in ta:
|
||||
## icons pass
|
||||
sql = set()
|
||||
itags = set()
|
||||
xml = xml_style_start()
|
||||
for entry in zsheet[zindex]:
|
||||
if entry["type"] in entry_types:
|
||||
if "icon-image" in entry["style"] and ("text" not in entry["style"] or ("text" not in entry["style"] and entry["style"].get("text-position","center")!='center')):
|
||||
xml += xml_rule_start()
|
||||
xml += x_scale
|
||||
xml += xml_filter(entry["rulestring"])
|
||||
xml += xml_pointsymbolizer(
|
||||
path=entry["style"].get("icon-image", ""),
|
||||
width=entry["style"].get("icon-width", ""),
|
||||
height=entry["style"].get("icon-height", ""),
|
||||
|
||||
opacity=entry["style"].get("opacity", "1"))
|
||||
sql_g = set()
|
||||
itags_g = set()
|
||||
xml_g = ""
|
||||
for zindex in ta:
|
||||
sql = set()
|
||||
itags = set()
|
||||
xml = xml_style_start()
|
||||
for entry in zsheet[zindex]:
|
||||
if entry["type"] in entry_types:
|
||||
if "icon-image" in entry["style"] and ("text" not in entry["style"] or ("text" not in entry["style"] and entry["style"].get("text-position","center")!='center')):
|
||||
xml += xml_rule_start()
|
||||
xml += x_scale
|
||||
xml += xml_filter(entry["rulestring"])
|
||||
xml += xml_pointsymbolizer(
|
||||
path=entry["style"].get("icon-image", ""),
|
||||
width=entry["style"].get("icon-width", ""),
|
||||
height=entry["style"].get("icon-height", ""),
|
||||
|
||||
sql.add(entry["sql"])
|
||||
itags.update(entry["chooser"].get_interesting_tags(entry["type"], zoom))
|
||||
xml += xml_rule_end()
|
||||
opacity=entry["style"].get("opacity", "1"))
|
||||
|
||||
xml += xml_style_end()
|
||||
sql.discard("()")
|
||||
sql.add(entry["sql"])
|
||||
itags.update(entry["chooser"].get_interesting_tags(entry["type"], zoom))
|
||||
xml += xml_rule_end()
|
||||
|
||||
xml += xml_style_end()
|
||||
sql.discard("()")
|
||||
if sql:
|
||||
sql_g.update(sql)
|
||||
xml_g += xml
|
||||
itags_g.update(itags)
|
||||
else:
|
||||
xml_nosubstyle()
|
||||
sql = sql_g
|
||||
itags = itags_g
|
||||
if sql:
|
||||
mfile.write(xml)
|
||||
mfile.write(xml_g)
|
||||
sql = "(" + " OR ".join(sql) + ") and way && !bbox!"
|
||||
itags = add_numerics_to_itags(itags)
|
||||
mfile.write(xml_layer("postgis", layer_type, itags, sql ))
|
||||
|
|
Loading…
Add table
Reference in a new issue