terriajs icon indicating copy to clipboard operation
terriajs copied to clipboard

Allow access to raw values of numeric columns in feature info template

Open tephenavies opened this issue 1 year ago • 1 comments

In the context of CSVs or tabular data, while it's useful to have non-numeric values (like "n/a") come through to mustache templates as falsey to allow for

{{column}}section only if numeric{{/column}}

it's also important to be able to show the original value from the CSV in feature info, even if that value is n/a or TBC.

Maybe we could implement this by adding terria.raw.column as a way to access this. I.e. replicate all columns in an object terria.raw, but fetch raw column values, rather than using computed methods that allow for null replacements and number formatting.

Current mustache context: image

Any opinions @nf-s?

### Tasks
- [ ] Decide if this is broadly beneficial
- [ ] Determine complexity of getting unformatted values

tephenavies avatar Nov 16 '23 01:11 tephenavies

It would be a nice addition - I like the idea of having a raw object on feature properties with unprocessed string values.

I'm a little worried about making TerriaFeature objects bigger - as they are all generated ahead-of-time - but in the scheme of things probably not a performance bottleneck. Cesium will definitely hit limits with number of features before running out of memory due to properties being large

nf-s avatar Nov 16 '23 12:11 nf-s