0

I'm trying to symbolize a line layer in CartoDB using CartoCSS. I need my line to be a series of diagonal lines, something like this -> /////////////

In QGIS I would do this as a marker line with a straight line set at an angle for the marker. However, I can't figure out whether such functionality is present in CartoCSS. I can't see anything in the documentation for marker lines. Is this not possible?

2

I recommend you to take a look at this nice tutorial about styling lines in CartoCSS: https://www.mapbox.com/tilemill/docs/guides/styling-lines/

I have done some tests in my CartoDB account, and this CartoCSS does something similar to what you need to obtain:

#untitled_table {
  ::line, ::hatch { line-color: #FF6600; }
  ::line { line-width:0; }
  ::hatch {
    line-width: 4;
    line-dasharray: 1, 4;
  }
}

Dashed line

If you need something more custom, you might want to try with the parameter line-pattern-file in CartoCSS to add your own pattern as the tutorial suggests :-)

3
  • Thanks. That's the solution I've settled on, but it doesn't give me the ability to slant the hatches, so my line looks like this ||||||| instead of like this ///////. – spencerrecneps Aug 21 '15 at 18:32
  • What about using your own pattern file with a "/" marker? – iriberri Aug 22 '15 at 16:56
  • I tried creating a pattern file with a diagonal line but it was blurred. I suppose there are probably tweaks I could make to get that method to work, but it seems like being able to define a marker line is obvious missing functionality. One shouldn't have to create a pattern file for a simple repeating marker. – spencerrecneps Aug 24 '15 at 12:43

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.