diff --git a/src/libkomapnik.py b/src/libkomapnik.py
index 2fec5eb..5659224 100644
--- a/src/libkomapnik.py
+++ b/src/libkomapnik.py
@@ -305,8 +305,11 @@ def xml_layer(type="postgis", geom="point", interesting_tags = "*", sql = "true"
if type == "postgis":
- if zoom >= 5:
- sql = 'way && !bbox! and '+ sql
+ waystring = 'way'
+ if zoom < 10:
+ waystring = "ST_Simplify(way, %s) as way"%(pixel_size_at_zoom(zoom,0.6))
+ if zoom >= 5:
+ sql = 'way && !bbox! and '+ sql
interesting_tags = list(interesting_tags)
if '"' not in "".join(interesting_tags) and "->" not in "".join(interesting_tags):
interesting_tags = "\", \"".join(interesting_tags)
@@ -319,7 +322,7 @@ def xml_layer(type="postgis", geom="point", interesting_tags = "*", sql = "true"
%s
- (select %s, ST_Simplify(way, %s) as way
+ (select %s, %s
from %s%s
where %s
) as text
@@ -335,7 +338,7 @@ def xml_layer(type="postgis", geom="point", interesting_tags = "*", sql = "true"
false
-20037508.342789244, -20037508.342780735, 20037508.342789244, 20037508.342780709
- """%(layer_id, db_proj, subs, interesting_tags, 0.6*pixel_size_at_zoom(zoom), table_prefix, geom, sql, intersection_SQL, db_user, db_name, db_srid, table_prefix, geom)
+ """%(layer_id, db_proj, subs, interesting_tags, waystring, table_prefix, geom, sql, intersection_SQL, db_user, db_name, db_srid, table_prefix, geom)
elif type == "postgis-process":
return """