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
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.andrew– andrew2016年04月13日 09:04:53 +00:00Commented Apr 13, 2016 at 9:04
-
You can also customize your basemap options using createLayer with Leaflet:
var map = L.map('map', options);
.ramiroaznar– ramiroaznar2016年04月13日 09:22:49 +00:00Commented Apr 13, 2016 at 9:22 -
It worked. Used the map options as documented here leafletjs.com/reference.html#map-optionsandrew– andrew2016年04月18日 06:03:26 +00:00Commented Apr 18, 2016 at 6:03