Closed stepankuzmin closed 7 years ago
👋 @stepankuzmin - thanks for providing this PR. I think I understand your usecase, but to make sure let me try to describe what you are doing:
If all of those things are true, then this PR looks good. However another alternative would be to:
map.toXML()
to serialize the config to XMLI think this latter idea might sound odd and you might not like XML. However it has the advantage that is is fast and well tested. The node-mapnik API for dynamically adding layers is not a commonly used code pathway whereas the fromString
is bombproof.
Wow, thanks @springmeyer! That's actually what I need! I did the trick like this: https://github.com/stepankuzmin/tilelive-postgis/blob/master/index.js#L40-L47
I didn't find the map.toXML()
method in documentation http://mapnik.org/documentation/node-mapnik/, maybe we should add it? Nevertheless, you can close this PR. Thanks!
@stepankuzmin glad that helps. I've added docs for map.toXML
in https://github.com/mapnik/node-mapnik/commit/89c0d43ce55329cd4bf32887717ad5612e16bbaf.
This PR will add
fromLayers(arr, initOptions)
method, wich allows to create map pool from array of Mapnik Layers like this:See #12 for issue.