5 votes

How to use cartodb.js without storing sql in javascript

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 ...
user avatar
5 votes
Accepted

Fitting bounds with Carto.js?

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 ...
user avatar
4 votes

Can CartoDB read data that are hosted locally?

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 ...
user avatar
4 votes
Accepted

Including chart based on fields in CartoDB infowindow?

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 ...
user avatar
  • 1,642
4 votes
Accepted

cartodb: ssl version of the light_all basemap

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....
user avatar
  • 1,642
4 votes
Accepted

Layer in CartoDB is being loaded but not being displayed?

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/...
user avatar
3 votes
Accepted

how to enable interactivity on named map in cartodb

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 ...
user avatar
3 votes
Accepted

Detecting "load" or "done" event after setting new CartoCSS using set() in cartodb.js

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("...
user avatar
3 votes

Enabling Multiple Layers in same Infowindow of CartoDB.js?

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 ...
user avatar
  • 236
3 votes
Accepted

Can we hide/show a Torque layer and/or set SQL?

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 ...
user avatar
3 votes

Is there a way to access the 'data' from the cartodb.createLayer function?

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/...
user avatar
3 votes
Accepted

Embeds with iFrames and Scripts in CartoDB InfoWindows

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, ...
user avatar
  • 4,772
3 votes
Accepted

custom tooltip generates "mapView should be present" error

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 ...
user avatar
  • 1,011
3 votes
Accepted

Mustache functions possible in CartoDB tooltip templates?

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 ...
user avatar
3 votes
Accepted

Using createLayer in CartoDB isn't working

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....
user avatar
  • 2,570
3 votes

Applying https to Carto map but requesting insecure data?

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 ...
user avatar
  • 395
3 votes
Accepted

Carto.js - Change infowindow field on click event

You have to set the cartodb_id interactivity in your layer_source variable: var layerSource = { user_name: 'examples', type: 'cartodb', sublayers: [{ sql: 'select * from ...
user avatar
  • 4,316
3 votes
Accepted

Using data from my cartodb in my search box

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 ...
user avatar
  • 4,316
3 votes
Accepted

How to add GPS UI on CARTO public_map and/or embed_map?

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 ...
user avatar
  • 4,316
3 votes
Accepted

Toggle between layers in Carto Builder

In order to toggle layers on/off using CARTO Builder, all you have to do is acces the Map Options (the sliders icon under the pencil at the far left) and turn on Layer Selector in the checklist. Here'...
user avatar
  • 456
3 votes
Accepted

Carto JS only gets cartodb_id on click

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 ...
user avatar
  • 311
3 votes

CARTO popup links redirect back to embed map?

You would need to remove the target property or set it as `"_blank" if you want to open a new browser tag. This is a basic HTML, that you can use as an example: <div class="CDB-infowindow CDB-...
user avatar
  • 4,316
3 votes
Accepted

Blocked loading mixed active content error when loading named map as layer in CARTO?

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:...
user avatar
  • 4,316
2 votes

Can CartoDB read data that are hosted locally?

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 ...
user avatar
2 votes

How to use cartodb.js without storing sql in javascript

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

Using Odyssey.js with Cartodb.js?

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....
user avatar
  • 129
2 votes

Enabling Multiple Layers in same Infowindow of CartoDB.js?

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/
user avatar
2 votes

Writing tests for cartodb

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:...
user avatar
  • 1,642
2 votes

Is there a way in Cartodb.js to include an autcomplete search bar?

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).
user avatar
2 votes

Viz.json-based map will not show Line polygons

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?
user avatar

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