I noticed recently that my published iframe map adjusts to whatever the zoom and centering is for that map on the cartodb site. So if I'm playing around with the cartodb map on cartodb, say exploring particular regions of the map, this will have a direct impact on what my website users see in the embedded map.

Is there a way to avoid this? I don't see any parameters for setting center or zoom in the iframe code:

<iframe width='100%' height='520' frameborder='0' src='http://sanjuro.cartodb.com/viz/10f021cc-b7a5-11e4-a4dd-0e853d047bba/embed_map' allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>

You can specify some flags in the URL to get the view you want.

The example below centers on [lat,long] = [34,-122] with zoom equal to 5.


| improve this answer | |

Just to complete a little bit Andy's answer with the information in the CartoDB Documentation here: http://docs.cartodb.com/faqs.html

In order to set the initial position of a map that you want to embed, you just need to adjust this position and the zoom value in the map of the visualization. If you want to edit the way that your links and embed maps are centered/zoomed after sharing, you can add the zoom, latitude and longitude parameters to the simple URL as follows:


You can also use the same trick in the HTML code that is given to embed your maps.

In case you’re using CartoDB.js, you can include these values in the options of the createVis method:

cartodb.createVis('map', 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json', {
  center_lat: 43.90,
  center_lon: -97.55,
  zoom: 5
| improve this answer | |
  • Thanks for the addition. Not enough reputation yet to upvote, sorry. – Sanjuro Feb 23 '15 at 19:23

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.