I made a map with a search box that is related to a country. Entering a postal code will zoom completly in to the asked postal code. I would like to center the map to this asked postal code, but not to zoom further in.

I saw several example maps with a maxZoom. Therefore I tried to set maxZoom in CartoDB.js. But it doesn't work. What am I doing wrong? You can see html so far here


You're not using a valid callback for the onDone, as it doesn't contain the vis object, so the maxZoom setting is not really being applied because the object to apply it is not there. :-)

You can use:

  .on('done', function(vis, layers) {


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.