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
})

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. :-)

3
  • Thanks @ramiroaznar, I thought one was able to set the map options on a base layer that is not provided by cartodb.
    – andy
    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
    – andy
    Commented Apr 18, 2016 at 6:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.