0

I have a table of points.

Each row has a string hex field that stores a color code in hex format: #000000.

I want to style my map so that each point displays with the color assigned to it.

But setting the CartoCSS marker-fill property to [hex] throws an error:

 #points {
   marker-fill: [hex];
 }

Is there any way that I can color my points based on a color field in my table?

2

You are missing ; at the end of your code. Check the following example:

image

sql

cartocss

  • I have updated my example, which I typed incorrectly. But my production code includes a semicolon, and still throws an error: "style0:3:2 Invalid value for marker-fill, the type color is expected. [hex] (of type field) was given." – CaitlinW Apr 6 '18 at 14:46
  • Can you share the link to your dataset? It should work both in Engine apps (as seen in my first screenshot) and in BUILDER (as in the new pictures added to my answer). – ramiroaznar Apr 7 '18 at 10:10
  • We're running an on-premise enterprise Carto server with private data, so I can't share. But if it helps, we're running Carto 2.0.0 - could it possibly be a version issue? – CaitlinW Apr 9 '18 at 14:06
  • 1
    I recommend contacting CARTO Enterprise support next time. I think you are right, maybe your BUILDER onpremise version is not having to use expressions in CartoCSS marker properties such as marker-fill. So not related to your data. Disclaimer: I work in CARTO. – ramiroaznar Apr 9 '18 at 15:48

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.