0

I am trying to do something very simple, but apparently impossible. Overlay two lines with different size and color signing same route different direction. Like this one: http://www.indianatrails.org/Pleasant_Ride/index.html

I couldn't find in CARTODB a way to put on top the green route. Please help!

2 Answers 2

1

You can choose the order in CartoDB in two different ways: having the geometries in different layers and moving a layer on top of the other one, or ordering the results of your table.

CartoDB draws the geometries by using the cartodb_id index by default. This means that a line with cartodb_id = 10 will be always plotted on top of other one with cartodb_id=9. If you're building the visualization on runtime and getting the data from a query, the system will take into account if you have a ORDER BY statement applied. If so, geometries will be drawn in an ascendent way with respect to the statement key.

So, basically, you need to set up a query that returns your data in the order you need. You can use a column to give priority to your blue lines over some green ones, and use a ORDER BY over it.

0

Another possibility is that you create different layers in your CartoCSS editor. CartoCSS create different layers when rendering based on the order you define them.

For example you could do:

#table_name[line_type = 'red']::z1{
  line-color: #FF6600;
  line-width: 2;
  line-opacity: 0.7;
}

#table_name[line_type = 'green']::z2{
  line-color: #229A00;
  line-width: 1;
  line-opacity: 0.7;
}

Where 'green' or 'red' are cell values of a column called 'line_type'

1
  • I have used ORDER BY and it works well. It keeps the same order for all the visualizations. If I understood correctly using CartoCSS it allows to make changes specifically to the table or visualization you are working on it leaving intact the other ones.
    – Giovassi
    Commented Feb 6, 2015 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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