5

If you want to have different visualisations but only modifying your query params, for instance because a filter changed and you want to change your where from WHERE somefield = 'x' to WHERE somefield = 'y', probably you want to have a look at the named maps + templates functionality provided by the Maps API. That allows you to create visualisations without ...


4

The CartoDB code is available on GitHub and you can run it on your own server but if that's what you want or need you should really look at the enterprise options Radek mentioned. If you absolutely must host it yourself you will need a specific version of Ubuntu and very specific versions of Ruby, Python, Node, Postgres and GIS libraries. It's a huge ...


4

In cartodb.js you have an example integration with google charts. Other charting libraries should work in the same way. You can see it working here. The key is to call the chart function inside the infowindow template, note draw_chart call: var INFOWINDOW_TEMPLATE = [ '<div class="cartodb-popup v2">', ' <a href="#close" class="...


4

you can use the following urls: https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png available subdomains are: abcd you can use subdomains leaflet option http://leafletjs.com/reference.html#tilelayer-subdomains


4

Which version of the library are you using? The correct way to load the latest version of cartodb.js would be: <link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.15/themes/css/cartodb.css" /> < script src="http://libs.cartodb.com/cartodb.js/v3/3.15/cartodb.js"></script> Also, you could find an example working with two ...


4

You need to use the CARTO SQL API to retrieve that information applying a query with ST_EXTENT and parsing the response. Here you have an example with simple code that you can use to get it running Get bounds with SQL API Pseudocode for those steps: const apiKey = 'YOUR_API_KEY'; const username = 'cartojs-test' const tableName = 'someTable'; const places ...


3

I feel a bit of an idiot for not figuring this out sooner. Here is the solution that worked for me. Add the following line to the namedmap definition: layers: [{}] The call to createLayer then looks like this: cartodb.createLayer(this.map.baseMap, { type: 'namedmap', user_name: 'myusername', options: { named_map: { ...


3

Load events seems to be supported (but aren't documented) on the dataLayer, but since promises aren't supported you would would have to setup the listener before you call the set, e.g: dataLayer.on("load", function() { console.log('layer changed'); }); dataLayer.getSubLayer(0).set({ cartocss: "#export { polygon-opacity: 0; }" });


3

There are a couple of solutions to this that both involve creating the layer object yourself - http://docs.cartodb.com/cartodb-platform/cartodb-js/layer-source-object/ The first option is to query a dataset directly and modify the cartocss as needed. You will then need to insert html infowindow template - infoWindow = cdb.vis.Vis.addInfowindow(map, layer, ...


3

You can apply the torqueLayer.hide() and torqueLayer.show() methods to control the display of your Torque layer. There is also the torqueLayer.setSQL('...') option. With all of these, you need to make sure that your data is not set to private because these do not work with named maps unless you add some additional parameters to the config file. A key thing ...


3

The vizjson file that defines the layer doesn't contain the data you need. Take a look at the response of the request triggered by createLayer, which looks like http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json?callback=vizjson (too long to be pasted here). Maps API is focused on presentation and SQL API is focused in ...


3

By using CartoDB.js you can set sanitizeTemplate as false in order to run your scripts inside custom infowindows. An example: cartodb.createVis('map', 'viz_json', {options}) .done(function(vis, layers) { var d = layers[1].getSubLayer(0); d.infowindow.set({sanitizeTemplate:false}); d.infowindow.set("template", function(g) { ... });


3

This problem is due a bug in the latest versions of CartoDB.js (the 3.14 and 3.15). We are looking into it to solve the problem and to update those versions with the fix as soon as possible. We have detected that for the versions 3.11, 3.12 and 3.13, the tooltip works and it doesn't show the error message "Uncaught Error: mapView should be present". Here ...


3

Yep! Checkout the documentation in CartoDB.js for more on how to integrate it into your map application: https://docs.cartodb.com/cartodb-platform/cartodb-js/ui-functions/ If you checkout the infowindow or tooltip template code, which you can access through the tray on the right in the CartoDB Editor -> Infowindow tab. Read more in the Editor docs to see ...


3

Two things here checking on your fiddle. First is you are putting the https:true option in the wrong place, you need to add it to the next parameter. In normal JS it would be like this: cartodb.createLayer(map, { user_name: 'user', filter: "mapnik", type: 'cartodb', sublayers: [{ sql: layer_sql, ...


3

A friend pointed out the answer, all I needed to add was this to the code: Add { https: true } as explained here: https://carto.com/docs/carto-engine/carto-js/getting-started/#https-support The example code they give: <div id="map"></div> <link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/...


3

You have to set the cartodb_id interactivity in your layer_source variable: var layerSource = { user_name: 'examples', type: 'cartodb', sublayers: [{ sql: 'select * from country_boundaries', cartocss: '#layer { polygon-fill: #F00; polygon-opacity: 0.3; line-color: #F00; }', interactivity: ['cartodb_id', 'abbrev'] ...


3

On the one hand, there is no name field in the ecngo_members dataset. So I recommend changing name to one of the existing fields, such as town. On the other hand, because your dataset contains points instead of polygons I would add map.setZoom(13); just after map.fitBounds(bounds);.


3

You can try CARTO mobile SDK (documentation) or use CARTO.js. If you choose the 2nd option, there are some questions that are already answered in this forum such as this one. But basically, you have to use map.locate Leaflet method.


3

Because columns are defined when setting interactivity, different than setInteraction - try this: .on('done', function(layer) { var sublayer = layer.getSubLayer(0); //which sublayer depends on your viz.json sublayer.set({ 'interactivity': ['cartodb_id', 'your_column_name'] }); sublayer.setInteraction(true); sublayer.on("featureClick",...


3

Checking on old CARTO.js GitHub issues, I have found a workaround that could solve your problem: placing the https after the named map definition: cartodb.createLayer(map, { user_name: user, type: 'namedmap', named_map: { name: 'name_whatever', ... } }, { https: true })


2

CartoDB is primarly offered as SAAS (Software as a Service) and their basic offerings are hosted. This means that if you have any of these accounts: http://cartodb.com/pricing/ then you cannot host it on your own server. However if you'd purchase Enterprise edition http://cartodb.com/enterprise/, then it is possible to host CartoDB on your own machine. This ...


2

I use squel.js to create SQL queries in javascript. It's pretty straightforward + lightweight to boot: http://hiddentao.github.io/squel/


2

Using Odyssey.js with Cartodb.js is a big problem for using viz.json (vizjson) in odyssey.js. The CARTO Builder does not have the option to share the viz.json URL due to the current version of CARTO.js (v3.15). This version is not compatible with the Builder. The new version of CARTO.js (v4) will be released by March/April 2017 and CARTO says that it will be ...


2

Yes, it's possible programmatically. This post does a very good job of explaining it: http://zevross.com/blog/2014/05/05/cartodb-handling-infowindows-for-overlapping-features/


2

Basically you can't test markers selecting them using DOM selector because the markers are rendered in images in the server and then displayed in the browser. The "right" way to test markers would be: 1 - load the map with the visualization 2 - get a png image from the DOM where src ends in "Z/X/Y.png" being Z,X and Y integers. 3 - check that the image ...


2

Yes, I've just made this example: http://bl.ocks.org/juanignaciosl/7b6f75a4edf875f8a778 (by joining http://bl.ocks.org/javisantana/7932459 with http://bl.ocks.org/javisantana/befa66fc9327f6c2908e).


2

I have done an example, based in the one you said didn't work], and it works: it displays the line and infowindow, at least in my browser. Maybe I did not understood your problem?


2

You were doing it basically right, check this full example: http://bl.ocks.org/javierarce/50244a6a7a8a4e1a959a


2

Yes, it's pretty easy to get the data to any DOM element you specify. If you look at the definition of events on layers, you'll see that the requested data is returned as a callback object: layer.on('featureOver', function(e, latlng, pos, data, subLayerIndex) { console.log("mouse over polygon with data: " + data); }); If you specify in your HTML ...


Only top voted, non community-wiki answers of a minimum length are eligible