zoomlevel-dependant polygon join treshold

This commit is contained in:
Komяpa 2011-01-12 22:26:21 +02:00
parent 9c85437f20
commit c0d0fc14c9
2 changed files with 9 additions and 2 deletions

View file

@ -378,11 +378,11 @@ for zoom, zsheet in mapniksheet.iteritems():
from (
select (ST_Dump(ST_Multi(ST_Buffer(ST_Collect(p.way),0)))).geom as way, %s
from (
select ST_Buffer(way, 16) as way, %s
select ST_Buffer(way, %s) as way, %s
from planet_osm_%s p
where (%s) and p.way && ST_Expand(!bbox!,500) and (%s)) p
group by %s) p order by ST_Area(p.way)
"""%(itags,oitags,oitags,layer_type,ttext,sqlz,oitags)
"""%(itags,oitags,pixel_size_at_zoom(zoom,10),oitags,layer_type,ttext,sqlz,oitags)
mfile.write(xml_layer("postgis-process", layer_type, itags, sqlz, oitags ))
elif layer_type == "line":
sqlz = " OR ".join(sql)

View file

@ -55,6 +55,13 @@ def zoom_to_scaledenom(z1,z2=False):
#return 100000000000000, 1
return z1, z2
def pixel_size_at_zoom(z, l):
"""
Converts l pixels on tiles into length on zoom z
"""
return l* 20037508.342789244 / 256 * 2 / (2**z)
def xml_pointsymbolizer(path="", width="", height="", opacity=1, overlap="false"):
if width:
width =' width="%s" '%width