go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.25k stars 193 forks source link

Adding properties to auto generated style.json #853

Closed dwoznicki closed 2 years ago

dwoznicki commented 2 years ago

I'd like to add properties maxzoom + minzoom to one of the sources in the style.json generated from endpoint:

/maps/:map_name/style.json

Is there a way to do this?

It's also probably worth noting that there's a decent chance I'll want to make other changes to this style.json file, so I think what I'm really looking for is a way to extend the auto generated style.json with arbitrary properties.

ARolek commented 2 years ago

I'd like to add properties maxzoom + minzoom to one of the sources in the style.json generated from endpoint:

The style is built up in this HTTP handler:

https://github.com/go-spatial/tegola/blob/91cc879ff2fad4ea339d79d4d85bbd544768ca91/server/handle_map_style.go#L32

It looks like the min / max zoom are being computed though:

https://github.com/go-spatial/tegola/blob/91cc879ff2fad4ea339d79d4d85bbd544768ca91/server/handle_map_style.go#L80

Are you encountering an issue?

It's also probably worth noting that there's a decent chance I'll want to make other changes to this style.json file, so I think what I'm really looking for is a way to extend the auto generated style.json with arbitrary properties.

Not really. The style is really just used for the internal viewer and the intent is demonstrate "proof of life". If you want to build more complex styles, you should look into creating a separate stylesheet and deploying that via a client side experience. You can use a style tool like Fresco

dwoznicki commented 2 years ago

Are you encountering an issue?

I don't know if it's an issue exactly, but basically what I want to do is have my client stop requesting new tiles at zoom levels higher than 14. I found that I can accomplish this by setting a maxzoom property on the source in the style.json.

The style is really just used for the internal viewer and the intent is demonstrate "proof of life".

Gotcha. I thought it might be more tightly coupled with the server (i.e. the client has to use the style.json generated by the server in order for the tiles to display properly), but it sounds like as long as the layer names match what I have in my tegola.toml file, it should be fine.

Thanks!