node-mapnik
node-mapnik copied to clipboard
bindings for manipulating styles?
Are there any plans to implement bindings for manipulating styles, symbolizers and filters? I'd love to take output from TileMill and e.g. tweak a filter on a layer and save out a sequence of animations.
Just wondering if this is a "bad idea, do it another way" thing or a "great! we just didn't get to it yet" thing. Assuming the latter I can help.
I've not gotten around to this mainly since TileMill hasn't needed it yet. We've been enjoying (getting away with) the simplicity of dealing with styles as json objects (carto's internal representation) and then just handing off to mapnik in one big chunk of XML.
Do you have ideas on how you'd ideally like access to the underlying styles?
Not yet!
Could/should I be generating carto styles and passing those to a mapnik.Map somehow?
I could also generate the XML I guess?
mapnik.Map.load/loadSync/fromString/fromStringSync all expect XML. It's not obvious, but you can call them multiple times and styles/layers will accumulate, while any map level properties will get overridden by the last map loaded. So a quick cheat could be to export the XML from TileMill, remove the few styles/layers that you want to change (keeping other constant stuff). Then construct the style bits you want to change on the fly as XML chunks wrapped in <Map> </Map> and load them after loading the main map.