azavea / tilegarden

Serverless raster and vector map tile generation using Mapnik and AWS Lambda
https://azavea.github.io/tilegarden/
Other
97 stars 7 forks source link

Make XML map config primary #138

Closed KlaasH closed 5 years ago

KlaasH commented 5 years ago

Overview

Changes the way map configuration is handled so that rather than maintaining Carto styles that get compiled to Mapnik XML during build/deploy, we'll maintain actual Mapnik XML. Based on making the same move in the People For Bikes version, as recommended on issue 129.

Maintaining the config as XML has the major advantage that it allows adding configuration/optimization parameters to the layer config that aren't supported by Carto. The parameters added here helped improve the performance of PFB's tiles from many seconds to the 300-700ms range. (Different situations will differ, but the ability to tune the database parameters is likely to be important in most or all cases.)

It also reduces the number of moving parts that might do something unexpected. And it doesn't preclude working with Carto layer styling, since the build-all-xml command will compile the Carto style files into XML just as before. The difference being that now the XML files are tracked and the generated file will generally be the input to a manual process of validating and improving it.

Since compiling the config is no longer required and the XML will be tracked in the repo, filling in environment variables during config compilation won't work. So this also transitions to using environment variables in the Mapnik XML and replacing them with values from the environment at runtime. This should also make it easier to support deployment across multiple environments (e.g. local, staging, production).

Notes

I originally had more changes in this branch, toward facilitating deployment across multiple environments as mentioned above, but I decided to do that separately.

Testing Instructions