Попытка применить MarkersSymbolizer вместо LinePatternSymbolizer

This commit is contained in:
MaksVasilev 2014-04-22 15:10:13 +04:00
parent 8e1da17e83
commit 2581297c47
2 changed files with 6 additions and 5 deletions

View file

@ -526,11 +526,11 @@ if options.renderer == "mapnik":
os.makedirs(icons_path + "komap/")
if not os.path.exists(icons_path + "komap/" + fname):
im.save(icons_path + "komap/" + fname, "PNG")
xml += xml_linepatternsymbolizer("komap/" + fname)
xml += xml_linepatternsymbolizer("komap/" + fname, entry["style"].get("spacing","0"), entry["style"].get("max-error","0.25"), entry["style"].get("allow-overlap","false"))
except:
print >> sys.stderr, "Error writing to ", icons_path + "komap/" + fname
else:
xml += xml_linepatternsymbolizer(entry["style"]["pattern-image"])
xml += xml_linepatternsymbolizer(entry["style"]["pattern-image"], entry["style"].get("spacing","0"), entry["style"].get("max-error","0.25"), entry["style"].get("allow-overlap","false"))
sql.add(entry["sql"])
itags.update(entry["chooser"].get_interesting_tags(entry["type"], zoom))
xml += xml_rule_end()

View file

@ -88,7 +88,7 @@ def xml_pointsymbolizer(path="", width="", height="", opacity=1, overlap="false"
if height:
height = ' height="%s" ' % height
return """
<MarkersSymbolizer file="%s" %s %s opacity="%s" allow-overlap="%s" />"""\
<MarkersSymbolizer file="%s" %s %s opacity="%s" allow-overlap="%s" placement="point" />"""\
% (os.path.join(icons_path, path), width, height, opacity, overlap)
@ -129,9 +129,10 @@ def xml_polygonpatternsymbolizer(file=""):
<PolygonPatternSymbolizer file="%s"/>""" % (os.path.join(icons_path, file))
def xml_linepatternsymbolizer(file=""):
def xml_linepatternsymbolizer(file="", spacing="0", max_error="0.25", allow_overlap="false"):
return """
<LinePatternSymbolizer file="%s"/>""" % (os.path.join(icons_path, file))
<MarkersSymbolizer file="%s" spacing="%s" max-error="%s" allow-overlap="%s" placement="line"/>""" % (os.path.join(icons_path, file), spacing, float(max_error), allow_overlap)
def xml_textsymbolizer(