stadiamaps / cartogrify

The cartographic style transmogrifier
BSD 3-Clause "New" or "Revised" License
11 stars 0 forks source link

Support exponential stop functions #5

Open ianthetechie opened 3 years ago

ianthetechie commented 3 years ago

Mapbox GL supports stops (for width, colors, etc.) that follow both a linear and exponential progression. Tangram does not appear to support this directly, but cartogrify could reasonably fake it by computing the intermediate stop values.

Current status:

bcamper commented 3 years ago

For now, you would need to implement this as a custom JS function, such as one based on Mapbox GL's (last OS version v1.13.0):

https://github.com/mapbox/mapbox-gl-js/blob/f87090b70b8a6fbde1a779c44933ce32bffc5d2c/src/style-spec/expression/definitions/interpolate.js#L254-L265

I am interested in adding direct support for exponential interpolation in Tangram though, it's long been on the wishlist, just never got around to it.

ianthetechie commented 3 years ago

Yeah, I assumed as much. I've implemented a few similar things with JS functions already. Thanks a bunch for the direct source link! That will exponentially speed up my implementation of this ;)