开发者

How to control mapnik PointSymbolizer symbol alignment?

开发者 https://www.devze.com 2023-01-05 19:34 出处:网络
I\'m using mapnik to draw a layer with bitmap images. It works good, but it looks like the bottom-right of the image is the x, y of my coordinates. How to align the image so that the center of the ima

I'm using mapnik to draw a layer with bitmap images. It works good, but it looks like the bottom-right of the image is the x, y of my coordinates. How to align the image so that the center of the image is placed on my coordinates?

point_looks = mapnik.PointSymbolizer(output_filename_abs, 'png', 32, 32) 
layou开发者_高级运维t_rule = mapnik.Rule()
layout_rule.symbols.append(point_looks)
point_style = mapnik.Style()
point_style.rules.append(layout_rule)


Very stupid of me... the images I used are 16x16 pixels. Thus setting the size to 32x32 will put the lower-right corner as the center.


you can use transform parameter.

point_looks.transform="translate(-16,-16)"

take a look at SVG transform

0

精彩评论

暂无评论...
验证码 换一张
取 消