CartoDB / carto-react-template

CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
https://sample-app-react.carto.com
MIT License
39 stars 26 forks source link

How to Style layers without CartoCss #271

Closed LongJohnSilver1504 closed 3 years ago

LongJohnSilver1504 commented 3 years ago

How can I style layers now that carto does not recommend using cartocss and turbocarto. Where can I find documentation about it? Thanks

AdriSolid commented 3 years ago

Hey!

You can use our helper functions to create data-driven map visualizations.

Also, you can always style your data with accessors, i.e. styling the line color for a specific feature:

getLineColor: d => {
  if (d.properties.cartodb_id === 1) {
    return [255, 0, 0];
  }
  return [0, 255, 0];
}
borja-munoz commented 3 years ago

In addition to what @AdriSolid has pointed out, if you are using the CartoLayer from the @deck.gl/carto module, it uses the GeoJsonLayer for rendering, so you can apply any of the rendering options described in the documentation.

borja-munoz commented 3 years ago

Closing, feel free to reopen if you have additional questions.