I am working on a project in MapBox studio where I had to flip all the labels 180° that were on lines. Since its not possible to use text-orientation for labels on lines, I flipped the font file 180 degrees.

I now need to reverse the character strings before they are rendered. Is there a way to do this in MapBox Studio using CartoCSS ?

Something like


1 Answer 1


Where are you sourcing your data from? And are you trying to turn something like abcd into dcba?

If you're sourcing from a PostgreSQL database, there's the reverse() function for strings.

If you're sourcing from a shapefile, it shouldn't be too hard to write a function useing a spreadsheet application (e.g. OpenLibre) that copies one of the columns in the dbf into a new reversed column.

...but to actually answer your question directly: no, I'm pretty sure there is not a way to reverse text using cartocss. sounds like more of a candidate for a data preprocessing step.

  • I am using Mapbox Studio and all the data is coming from the MapBox streets source. If I cannot reverse the Mapbox sourced data then I'll likely have to source my own
    – jotamon
    Jan 6, 2015 at 18:52
  • Yeah, in that case, you'll have to source your own. Jan 6, 2015 at 19:47

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.