0

My map visualization has two layers:

1) A city layer where the cities are represented as standard markers.

2) A county layer underlying the cities which has county level aggregate data. The layer is a choropleth.

--

Can we get mouseover and / or mouseclick events working on both layers simultaneously?

I need to be able to click/hover a city or a county and get the popup data response. (and probably highlight the county polygon)

At this point I can access one or the other depending on their order in the vis. After looking around a bit it looks like at least at some point this was handled by a variety of workarounds.

I was hoping to get it going somewhat automagically. If not, is this template the "right" way of doing it? I could stuff all the data into one table but that feels like it will make more complication. Users will be entering new marker points into the DB and it would be preferable to keep that data on its own.

https://github.com/mhkeller/cartodb-templates/blob/master/basic/point-polygon-hover.html

Appreciate your help, I'm in the GIS deepend again.

1

Yep, mhkeller's way is great. Here is another example with minor variation from the lead developer of cartodb.js

http://bl.ocks.org/javisantana/6493211

0

Not sure about The Right Way™ but Keller's template works quite well for exactly what you're describing.

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.