t-rex
t-rex copied to clipboard
Is it possible to have variables/placeholders in style.json file?
Hi @pka,
I'm interested if Trex supports passing variables to the style.json file into the filters section.
For example: Right now in the project were we display vector tiles we do that per city so to display Miami and North Miami we need to create two style files. Smth, like:
- fl-state-place-1245000.style.json
- fl-state-place-1249450.style.json
Inside each of those files, we specify filter right now:

We are looking for a way how to optimize that and have only 1 file (in reality we support ~30 cities right now), so there will be like one file called fl-state-place-{placeholder of city id here}.style.json and as a result, {placeholder of city id here} will be applied for the filter in section I've mentioned above. Is this possible?
Back in version 0.7.0 I've added styling in the configuration file which looked like
[tileset.layer.style]
type = "fill"
[tileset.layer.style.paint]
fill-color = "#d8e8c8"
fill-opacity = 0.5
but I found it too cumbersome to follow the MBGL JSON changes. Therefore I decided to generate a minimal style file which is normally replaced by a custom made style (created with Maputnik e.g.). If you want to serve the style with t-rex you can place it as static file configured in the webserver section.
@pka - I'm not interested in this anymore. Feel free to close this.
I leave that open, since styles with runtime parameters could be interesting for others as well.