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

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

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

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.