Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays in properties #77

Open
indus opened this issue Feb 28, 2023 · 3 comments
Open

Arrays in properties #77

indus opened this issue Feb 28, 2023 · 3 comments

Comments

@indus
Copy link

indus commented Feb 28, 2023

I'm having problems to get a ['at', n, array] expression to work in maplibre with data produced with tippecanoe. I wonder if that is because array properties still get stringified in tippecanoe (as the Changelog states for version (1.7.2)[https://github.com/felt/tippecanoe/blob/main/CHANGELOG.md#172] ). Is there a way to overcome this and make use of expressions that can handle arrays?

@bdon
Copy link
Contributor

bdon commented Feb 28, 2023

Have you gotten this to work outside of tippecanoe? I think this is a limitation of the tile specification https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L17 and MapLibre expression language, and maybe not this tool.

@indus
Copy link
Author

indus commented Feb 28, 2023

I havn't tried any other tools to generate pbfs with encoded array properties.

It was just the last sentence in the following part of the expression documentation that made me believe that option would exist:

If an expression accepts an array argument and the user supplies an array literal, that array must be wrapped in a literal expression (see the examples below). When GL-JS encounters an array in a style-spec property value, it will assume that the array is an expression and try to parse it; the library has no way to distinguish between an expression which failed validation and an array literal unless the developer makes this distinction explicit with the literal operator. The literal operator is not necessary if the array is returned from a sub-expression, e.g. ["in", 1, ["get", "myArrayProp"]].

["get", "myArrayProp"] looks like a normal access to a property .

@indus
Copy link
Author

indus commented Feb 28, 2023

Oh maybe this only works with GeoJSON sources 🤔
Looks like I have to keep an eye on mapbox/vector-tile-spec#75
But it seems that the clients are ahead of the data processing tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants