0

I added a cartoDB layer to an existing map using createLayer method and it loaded properly. Thereafter, created a variable params and parsed the arguments as sees on the code snippet below. Unfortunately I am not able to see the title, shareable button and the search bar on my map. What could be wrong?

var params = {
 search: true,
 cartodb_logo: false,
 mobile_layout: true,
 shareable: true,
 title: true
}
cartodb.createLayer(map, jsonUrl, params).addTo(map)
.on('done', function(layer){
 layer.setZIndex(1000); baseLayer
})
asked Apr 13, 2016 at 6:11

1 Answer 1

1

There are a couple of things wrong in your code. First of all, you should use createVis instead of createLayer in order to set map options. Then, you have to use as function arguments vis and layer/s if you want to set interactions. Here I have built a working example using createVis with map options like the ones in your params object. :-)

answered Apr 13, 2016 at 8:51
3
  • Thanks @ramiroaznar, I thought one was able to set the map options on a base layer that is not provided by cartodb. Commented Apr 13, 2016 at 9:04
  • You can also customize your basemap options using createLayer with Leaflet: var map = L.map('map', options);. Commented Apr 13, 2016 at 9:22
  • It worked. Used the map options as documented here leafletjs.com/reference.html#map-options Commented Apr 18, 2016 at 6:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.