I am creating a web map using CartoDB, and am having trouble creating buttons that will set a new view when clicked. I am a novice when it comes to coding but i do have some basic knowledge.

I'm thinking its going to involve creating a new visualization using CartoDB's .createvis command and a SQL statement but I'm not sure.

Any advice?

1 Answer 1


Here you have a working example with a "Reset Zoom" buttom. First you have to create a HTML kind of buttom:

<div id = 'reset'><p>Reset Zoom</p></div>

Second, you need to use JQuery in combination with the setView CartoDB.js function:

          map.setView([41.390205, 2.154007],12);

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.