Customize Infobox and Click Handler with Leaflet integration

734 views
Skip to first unread message

Tac Tacelosky

unread,
Nov 13, 2012, 7:15:49 AM11/13/12
to car...@googlegroups.com

This is probably a pretty simple question, and I'm hoping someone can point me to an example.

I'm moving from a GeoJSON-based map layer on Google Maps to a CartoDb layer on Leaflet. When I click on a point on a GeoJSON layer, the feature is returned as an object, so it's easy to pop up an infobox, make an Ajax call to update some other part of the screen, etc.

How do I do that with a CartoDb layer? I basically want to say "highlight the point nearest to where I clicked on the map, pop up a custom infobox, and fire an event so I can update other data on the page (that's too complex to fit in an infobox).

This seems like it'd be a common thing, can someone point me to an example?

Thanks,

Tac

Andrew Hill

unread,
Nov 13, 2012, 1:57:00 PM11/13/12
to car...@googlegroups.com
Hi Tac,

It sounds like two relevant examples are needed here. First is the pop-up example,


If you look at the source you will see how featureClick is used to get the location and then do something with that click event. You might also find the hover example useful, but maybe not,


Cheers,

a




--
 
 
 



--

Andrew W. Hill, Senior Scientist 
www.vizzuality.com | @andrewxhill

Map, analyze and build applications with your data

alani

unread,
Nov 29, 2012, 7:55:00 AM11/29/12
to car...@googlegroups.com
Hi Tac,

did you figure something out? I'm also searching for possibilities to update content with an Ajax call. It would be great to see an example!
Thanks!
Reply all
Reply to author
Forward
0 new messages