Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [carto-js]

a JavaScript library that interacts with the CartoDB service. It enables you to connect to your stored visualizations, create new visualizations, add custom interaction, and access or query raw data from a web browser.

-1
votes
0answers
51 views

Leaflet/CARTO.js: Emulate layer click (=open info window) after search & fitBounds?

I defined info windows with the CARTO.JS event "featureClicked" - unfortunately, this does not work after the user selects a layer in the search bar that is not part of the actual map. Any idea how ...
0
votes
1answer
71 views

Leaflet map with jQuery autocomplete: fitBounds (click input) on selection?

I'm trying to fire a click event on my search button and/or the input field as soon as a user selects something from the jQuery autocomplete <li>: https://jsfiddle.net/grh2dLyw/1/ I'm not sure ...
0
votes
1answer
15 views

How to use CARTO map visualization in Odyssey.js sandbox

I have a story map in Odyssey's sandbox GUI. I want to use a visualization I have in CARTO as a base map for this map. How can I find my viz key? All the documentation seems to refer to an option that ...
0
votes
1answer
207 views

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

I am unable to get my layers to draw on my Carto map using https. My map is created I can see the basemap, but the layers do not draw. The layers load locally, but they won't when I host the site on ...
0
votes
1answer
18 views

Carto zoom to areas in “link second layer”

I have a Carto map with two layers which I have linked using Carto's "Link Second Layer" analysis. I added a widget which lets me select the name of polygons and through this link, the map returns ...
0
votes
1answer
45 views

Error while rendering Map from CARTO without any code change [closed]

I have suddenly started getting error while rendering US map. This has come without any code changes. We are using CARTO.js. Uncaught TypeError: Cannot read property 'lat' of undefined at d....
0
votes
1answer
34 views

Carto.JS - Pop up closes when mouse hovers out of feature

As per the CARTO docs I am using the following code to trigger a info pop up when the user's mouse hovers over a feature: const popup = L.popup({ closeButton: false }); ecosystem.on(carto.layer....
0
votes
1answer
97 views

React / CARTO Enabling interactions

I have a React JS component that adds a Layer to the Basemap: componentDidMount() { const { client } = this.props; // Craete source, styles and layer with the given props const ...
0
votes
2answers
112 views

CARTO.js / ReactJS: Showing and hiding layers on toggle

I have a the following layer: class DataLayer extends Component { static contextTypes = { map: PropTypes.object, // Leaflet map }; componentDidMount() { const { client } = this.props; ...
0
votes
2answers
104 views

Adding a legend to CARTO.js v4 map application

I have made a map that shows fire risk for the different Districts within South Africa, and each fire risk is styled by value to match a certain color. I am trying to add a legend to show what each ...
0
votes
1answer
50 views

CARTO.js (V4) - How to style different values of a polygon

Using Carto.js V4, I have added a layer that shows fire risk levels (low, medium, high and extreme) for South Africa. This is the code I have used to call the layer from my Carto library: const ...
0
votes
1answer
41 views

CARTO popup links redirect back to embed map?

When I click a link in the pop-up window the link opens a new tab to the same CARTO map instead of redirecting to the url specified. Here is my code: <div class="CDB-infowindow CDB-infowindow--...
1
vote
1answer
144 views

Adding SQL layer with dropdown selector in Carto?

I am trying to make a map that has a layer showing District boundaries of South Africa, with a selector allowing the user to view which climate change indicators are a priority to each District. Using ...
0
votes
1answer
42 views

Torque.js error creating layertorque: Missing closing ] of filter

I've been trying to create a cartodb map with a torque layer as indicated in the Torque.js documentation, but I keep getting the same error: cartodb.js:14 MAP: error creating layertorque Error: :...
1
vote
1answer
59 views

Torque.js is not working: L.TorqueLayer is not a constructor

I've been trying to create a carto map with a torque layer as indicated in the Torque.js documentation, but I keep getting the same error: Uncaught TypeError: L.TorqueLayer is not a constructor &...
0
votes
1answer
133 views

Data from dataview doesn't update after changing the operation

I'm trying to update some dataviews' operation by a select item. The operation has been changed but the data didn't (so it doesn't trigger a 'dataChanged'). I've tried without boundingBoxFiltering but ...
0
votes
1answer
193 views

How to use the the Category Widget in the CartoJS v4?

I'm looking into using the Category Widget in a custom Map, using Carto JS v4. I've managed to get the data to show up on my map, and Now I want to have a category Widget, like the one you have Carto ...
0
votes
1answer
149 views

Fitting bounds with Carto.js?

I am new to Carto.js and I don't understand how to work with it SQL. How do I get bounds for this query? const places = new carto.source.SQL(`SELECT * FROM someTable`); I saw an example with ...
-1
votes
1answer
294 views

Using Carto.js with free account? [closed]

I have a website running with an old CartoDB account and I would like to make some improvements. With the arrival of CARTO BUILDER, I lost the opportunity to share layers and thus be able to use ...
0
votes
1answer
66 views

replacement for cartodb.SQL({user: 'user'}).execute(sqlquery) in new cartojs

this used to be my code in older carto.js cartodb.SQL({user: 'user'}).execute(sqlquery).done(function (data){ console.log(data); } how to readapt it in newer cartojs 4.0 beta
0
votes
2answers
239 views

Multi layer interactivity not working with carto.js

I've two sublayers with interaction set as true and the proper columns added in the interactivity method. The featureClick listener is attached to the layer. On the one hand, popups are working on ...
2
votes
2answers
121 views

Carto SQL fails due to CORS error in local CartoDB?

I have successfully installed CartoDB in Ubuntu 14.04 LTS and uploaded a point geometry dataset. I have created a HTML/JS application to access the layers from the local cartodb and visualize in the ...
0
votes
1answer
86 views

Cartodb popup opening at wrong location

i am using carto js to load a map and inbuilt leaflet to load additional points following (see image below) is the error i am getting. i am using this js <script src="http://libs.cartocdn.com/...
1
vote
1answer
120 views

Using Carto API in HTML

I am trying to use CARTO API with my HTML to display a map, code below: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>...
4
votes
2answers
71 views

Unable to connect POSTGIS Table to CARTO

I am a new Carto Builder (enterprise) User and I am trying to connect a Postgres9.6.4 / PostgiS 2.3.1. table to my datasets. Here is my script that should do the trick but I receive an extra long ...
1
vote
1answer
99 views

Centre map on marker click in CartoDB

How do I centre my map after clicking on a marker in carto js? I'm using createLayer but not sure where my listener should be applied (i.e. to map object created using Leaflet or within createLayer ...
0
votes
1answer
94 views

Proper use of layer.invalidate() in Carto.js

According to the Carto.js documentation, layer.invalidate(): "Refreshes the data. If the data has been changed in the CARTO server those changes will be displayed. Nothing happens otherwise. Every ...
-1
votes
1answer
195 views

how cartodb.createLayer function works

i am using cartodb.createLayer() function to prepare my web application. I have tried to pass vizjson url and metadata method both to get my layers from my carto account which has total of 8 layers in ...
0
votes
0answers
39 views

Refresh sublayer in CARTO.js [duplicate]

I've updated data in my carto account and wanting to see those changes reflected on the map I create using CARTO.js, however I'm unable to find a way to automatically refresh the respective sublayer ...
0
votes
0answers
53 views

Layers Zindex on charging Named Maps in carto

Right now I have an application that allows me to load a Named Map (NM) under petition. The problem is that when a NM is charged on the map, sometimes the features overlap one with another. I imagine ...
0
votes
0answers
73 views

Why raster image uploaded in Carto has some blackened areas?

When I upload my geo-referenced raster file to Carto and display it in a web application I get the result below ; But When I use gdal2tiles for the same image and create tiles I'm not getting those ...
0
votes
0answers
27 views

How do I set styles by SQL query in Carto JS API? [duplicate]

Let's say my Carto data looks like this state, val1, val2 Alabama, 10, 20 Delaware, null, 100 I want to set each state's color based on the sum of val1 and val2. How do I do this in Carto's ...
0
votes
1answer
76 views

Carto JS only gets cartodb_id on click

Here's my code: function main() { // create leaflet map and define some properties var map= L.map( "map", { ...
1
vote
1answer
95 views

Problem updating infowindow

I have a problem with the infowindow of one of my sublayers in a Carto map. First of all I'll show my code. I create the layer options and then I get my sublayer. I set its options and a first version ...
1
vote
0answers
217 views

How to show a carto map in an ionic 2 app?

Has anyone shown a carto map in an ionic 2 app? When I used ionic 1 there was no problem, because it is angular js and I could add the library in the index.html: <link rel="stylesheet" href="http:/...
1
vote
1answer
109 views

How to get sublayer infowindow to close in Carto.js

I have a map with 5 different sublayers and am having an issue with the infowindows between sublayers. If I click on a sublayer point to open an infowindow and then click on a different sublayer to ...
-1
votes
1answer
106 views

Map with polygons evolution over time

I want to put a button on a map with polygons so that you can see an evolution over time. The problem is that clicking on these buttons is not getting any response. It also happens that the provinces ...
0
votes
0answers
552 views

What are the licensing rules for using cartodb's public REST API with leafletjs

I am currently working on a project which needs some offline mapping. I am using Leaflet.js as my base library. I have also seen that leaflet can be used with the following tile providers: https://...
0
votes
1answer
478 views

Toggle between layers in Carto Builder

If you publish a map with multiple layers using Carto Builder, is there a way for viewers of a map to toggle on/off a specific layer? For example, imagine a choropleth map with a map marker overlay. ...
1
vote
1answer
325 views

Carto: Markers being offset or cut-off on polygon & marker map

I am seeing artifacts and markers are getting cut-off on my map. Zooming in and out can also leave an 'imprint' of what the map looked like before - either for a few seconds or until you refresh the ...
2
votes
1answer
247 views

Centering map with Carto Builder?

In previous versions of Carto it was easy to set the zoom and center-point of a map embed via URL parameters http://<username>.carto.com/viz/<viz_id>/embed_map?zoom=3&center_lat=0&...
1
vote
1answer
103 views

MIME type not executable error in CartoDB

I'm having trouble serving a layer using the Cartodb JS API. Essentially, the script is being refused because of MIME type. I notice ?callback=vizjson has been appended to the end of the URL (see ...
1
vote
3answers
102 views

carto api with javascript using online carto db. Argument of WHERE must be type boolean, not type geometry

I am using cartodb api to fetch the geojson from the cartodb data set using this code var map = L.map('map',{ center: [-35.1393961, 149.8530818], zoom: 13}); var alpha=map.getBounds(); var lat0=...
1
vote
1answer
268 views

CARTO/Leaflet: How to improve map performance?

I'm having problems getting my map to load data consistently quickly and smoothly. The buttons on my map execute sql queries to display data per category and by year. When I click between them, ...
1
vote
1answer
288 views

How to get CARTO.js vizjson URL

I am new to CartoDB. I have a free user account with 5 maps. I cannot see CartoDB.js URL just in a publish map. I have got just 'Get the link' and 'Embed it' publish map possibility and not the third ...
0
votes
0answers
157 views

cartoDB autocomplete search box don't work for my username

I found example for autocomplete search box here Is there a way in Cartodb.js to include an autcomplete search bar? I try solution http://bl.ocks.org/juanignaciosl/7b6f75a4edf875f8a778 but when I ...
1
vote
0answers
102 views

Why won't my street addresses georeference?

I've been using Carto for about a month or two now and it had been working perfectly, however it suddenly malfunctioned today. I updated my excel document (nothing changed except the number of rows), ...
1
vote
1answer
107 views

Carto JS no sublayer event response

I'm trying to create a custom infowindow based on cartojs sublayer. I've tried many things, but through testing I think the issue is that the event is not being registered/recognized on any of my ...
0
votes
1answer
174 views

Carto.js Infowindow Listeners open/close Events

I have a website with the carto.js library and some layers loaded. If I click on a feature, an Infowindow is opening up. I know that there is an event for the feature click: sublayer.on('...
0
votes
1answer
689 views

Migrating from CARTO Editor TO CARTO Builder and problem with odyssey.js (viz.json)

In odyssey.js you have: -vizjson: URL like this "//username.cartodb.com/u/usernanme/api/v2/viz/key/viz.json" The first thing we want to do is bring the CartoDB Visualization we created into the ...