In CARTO VL linear function expects a date or numeric field as its first argument. But when the data source is a GeoJSON, date fields are stored as categorical/strings and it returns an error like this:

CartoValidationError: [Property with an incorrect type]: linear(): invalid first parameter 'input' expected type was one of number,date, actual type was 'category'

You can test it in this visualizer replacing the current CARTO VL viz style with something like:

 filter: animation(
                fade(0.5, 0.5))

Is there any workaround to convert this (string/categorical) date field to a proper date/timestamp field in CARTO VL?


The GeoJSON source method has an option to indicate the 'date' columns.

Can you try with something like this?

const dateColumns = ['date'];
const options = { dateColumns };
const newSource = new carto.source.GeoJSON(JSON.parse(this.source), options);


| improve this answer | |
  • Thanks Victor! :magic: – ramiroaznar Aug 7 '19 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.