More

Deactivating InfoWindow on certain Elements using CartoDB?

Deactivating InfoWindow on certain Elements using CartoDB?


In CartoDB: How can I disable/deactivate the InfoWindow on certain Elements? For example if I have a layer with multiple lines, but only want a on-click-Infowindow or on-hover-InfoWindow on line 1 and 3, but not 2?

Ditto for Labels.

example: show infowindow on the solid red lines, but not on the dashed line (all lines are on the same layer)


In the CartoDB editor, you can easily separate your lines into different layers and then turn the infowindows on or off accordingly.

While in the "map view" of your data, you will click on the SQL wizard and write a statement that selects line 1.

I'm not sure how your data is organized, but for example, if you've assigned each line a numerical category you could write a statement like:

SELECT from #yourtablename WHERE category = 1

which will return only the rows whose category is 1.

You will then then click on the infowindow wizard and "turn it on" by adding the elements that you'd like to show.

You will then click on the "add layer" button and add your original layer again, and do another SQL query in the wizard that selects line 2.

SELECT from #yourtablename WHERE category = 2

You can then disable the infowindow by clicking on its wizard and ensuring none of the elements are selected.

Repeat this process until all your lines have been assigned a separate layer with the appropriate infowindow setting. You can do the same thing with your labels.

I hope this was helpful to you!


Watch the video: Google Maps API Setup part1 - Android Google Maps Course