mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.24k stars 2.23k forks source link

Master ticket tracking expression API completeness #6484

Open anandthakker opened 6 years ago

anandthakker commented 6 years ago

This ticket is intended to define what set of operators would constitute a "complete" expression API and track its implementation.

1ec5 commented 6 years ago

All the relevant functions from NSExpression

Inspired by this issue, I attempted to compile a similar issue to track feature parity with NSPredicate and NSExpression: mapbox/mapbox-gl-native#11786.

gorshkov-leonid commented 6 years ago

Hi, I have not found

  1. toHex(or toString(16))
  2. substrig to save to variable
  3. modification operation: variable(set) / object(set) / array(splice)
  4. how about supporting #FFFFFFFF(8 bytes) from css4 - number->to-color? So. all ideas from https://gist.github.com/gorshkov-leonid/bd4d603fd049f4419983cfb80e221688, I think it is verry complicated solution and new features can make it better
stevage commented 4 years ago

Oh, I didn't know about this ticket!

Me, I would love more string-handling functions:

lbutler commented 4 years ago

Oh, I didn't know about this ticket!

Me, I would love more string-handling functions:

  • left
  • right
  • split
  • titlecase (yes I know it's difficult to do in a locale-independent way)

@stevage, just letting you know that my PR #9450 was merged in and soon you will have slice which you can use on strings to do left/right/mid. Check out #9443 to see some examples.

It's not perfect but if you had just a single word you could always slice the first letter and uppercase it and concat with the remainder of the string, something like the below (untested!)

['concat', ['upcase', ['slice', ['get','attributeToTitleCase'], 0 ,1]], ['downcase', ['slice', ['get','attributeToTitleCase'], 1]]]

FinnRG commented 3 months ago

@mourner We extended mapbox-gl with a few basic date functions (new datetype, epoch: int -> date, hour and minute to get those values from a date value). Those are obviously pretty specific for our use case, but I could dedicate time to implement a more general date API.

My questions would be: