diff --git a/src/komap.py b/src/komap.py index ae27cd9..c3f9ea0 100644 --- a/src/komap.py +++ b/src/komap.py @@ -64,6 +64,8 @@ parser.add_option("-p", "--osm2pgsql-style", dest="osm2pgsqlstyle", default="-", help="osm2pgsql stylesheet filename", metavar="FILE") parser.add_option("-b", "--background-only", dest="bgonly", action="store_true", default=False, help="Skip rendering of icons and labels", metavar="BOOL") +parser.add_option("-T", "--text-scale", dest="textscale", default=1, type="float", + help="text size scale", metavar="SCALE") parser.add_option("-c", "--config", dest="conffile", default="komap.conf", help="config file name", metavar="FILE") @@ -85,6 +87,7 @@ libkomapnik.cleantopo_dem_path = config.get("mapnik", "cleantopo_dem_path") libkomapnik.srtm_dem_path = config.get("mapnik", "srtm_dem_path") libkomapnik.cleantopo_hs_path = config.get("mapnik", "cleantopo_hs_path") libkomapnik.srtm_hs_path = config.get("mapnik", "srtm_hs_path") +libkomapnik.text_scale = options.textscale from libkomapnik import * diff --git a/src/libkomapnik.py b/src/libkomapnik.py index 228cb00..e1fdc01 100644 --- a/src/libkomapnik.py +++ b/src/libkomapnik.py @@ -34,7 +34,7 @@ cleantopo_dem_path = "" srtm_dem_path = "" cleantopo_hs_path = "" srtm_hs_path = "" - +text_scale = 1 substyles = [] @@ -132,9 +132,9 @@ def xml_textsymbolizer( color = nicecolor(color) halo_color = nicecolor(halo_color) pos = pos.replace("exact", "X").replace("any","S, E, X, N, W, NE, SE, NW, SW").split(",") - pos.extend([str(int(float(x))) for x in size.split(",")]) + pos.extend([str(int(float(x)*text_scale)) for x in size.split(",")]) pos = ",".join(pos) - size = size.split(",")[0] + size = str(int(float(size.split(",")[0])*text_scale)) placement = {"center": "interior"}.get(placement.lower(), placement) @@ -163,7 +163,7 @@ def xml_shieldsymbolizer(path="", width="", height="", return """ """%(icons_path, \ - path, width, height,text,face,int(float(size)),color,halo_color,halo_radius,placement,offset,overlap,wrap_width,distance,align,opacity, transform, unlock_image, spacing ) + path, width, height,text,face,int(float(size)*text_scale),color,halo_color,halo_radius,placement,offset,overlap,wrap_width,distance,align,opacity, transform, unlock_image, spacing ) def xml_filter(string): return """