Questions tagged [carto-js]
CARTO.js is a JavaScript library that interacts with different CARTO APIs. It is part of the CARTO Engine ecosystem.
211 questions
0
votes
1
answer
337
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 ...
1
vote
1
answer
266
views
Interactivity in CartoDb with createLayer method?
I have a problem with my interactivity and I can't solve alone. When mouse hover are on any point I would like show by console.log any column of my dataset.
With my code, only show me cartodb_id.
...
0
votes
1
answer
157
views
Apply a polygon filter to CartoJS 4 dataview
Checking this example on CartoJS 4 documentation https://carto.com/developers/carto-js/examples/#example-filter-data-using-drawing-tools, you can apply a circle filter to a source. The problem with ...
1
vote
1
answer
354
views
Using createLayer in CartoDB isn't working
So, the scenario is I have a situation where users can look up multiple tables worth of data, and want to view them in an aggregate fashion. Based on certain filters, I get a list of tables, then want ...
-1
votes
1
answer
114
views
Interactive filtering histogram widget with cartoJS
I would like an interactive filtering histogram widget like this one https://public.carto.com/builder/0c982e6d-b254-4e2b-86ed-e0f097f519c2/embed (the population density histogram widgets on right ...
0
votes
1
answer
104
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: :...
0
votes
1
answer
778
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 ...
1
vote
1
answer
82
views
How to setBounds on a CartoJS 4 boundingBox?
I have tried to find an example on how to setBounds on a carto.filter.BoundingBox with no success. There is examples of carto.filter.BoundingBoxLeaflet which takes map as parameter.
const ...
1
vote
1
answer
167
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
1
answer
31
views
Access feature data for all features in a NamedMap
For any Cartodb NamedMap, we load it using this function:
cartodb.createLayer(map, namedLayerSource, {https: true})
.addTo(map)
.done(function (layer) {
});
After that I need to ...
3
votes
3
answers
449
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 ...
1
vote
4
answers
1k
views
Can CartoDB read data that are hosted locally?
Can CartoDB read from tables/data hosted on a local machine and not necessarily uploaded to CartoDB's website?
0
votes
1
answer
55
views
Is it possible to share CARTO datasets with password?
It's my understanding that only CARTO maps can be password-protected, not datasets. I'm currently using the datasets like so:
const source = new carto.source.Dataset(dataset);
const style = new carto....
0
votes
1
answer
124
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
votes
1
answer
65
views
data dots shift when using cartodb.js
As you can see this is a tutorial example map. It works strangely on my own website. The Florida location is now shifting down a little bit. In fact, all of the dots shift down a little bit.
How do ...
0
votes
1
answer
37
views
CARTO.js changing the styling only on one segment of a line with multiple segments
I'm attempting to change the styling of a line segment when clicked on a layer that has 4 segments. Only one segment's style would be changed at a time. Each segment has it's own column within a CARTO ...
1
vote
2
answers
316
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
vote
1
answer
235
views
Have Feature Click Events for Two Layers On, but only one is active at a time in CARTO.js 4
I am currently developing an application using CARTO.js 4, see here. We have a slider where layers for different years of data are loaded on both sides so you can compare them. We have a feature event ...
1
vote
1
answer
1k
views
Accessing table fields in hover function using CartoDB.js
I am new to CartoDB.js and javascript in general, and I am attempting to highlight polygons in response to a mouse hover. My plan of attack attempts to utilize one of the interesting templates ...
0
votes
1
answer
47
views
.createLayer method in CARTO.js (v4)
Trying to recreate an application made in carto v3 in the new version of carto (v4); here is the one which was create using v3. Problem we are running into is that we can't seem to figure out how to ...
1
vote
3
answers
226
views
Getting data manually from CARTO.js four dataview?
I have a series of CARTO.js four dataviews, but I want to manually get the data instead of listening to the 'dataChanged' event (when multiple datasets are created, this end in multiple errors). I ...
0
votes
0
answers
44
views
Creating subLayers using CARTO JS v4.1.8
I created a simple map with multiple layers using the below code.
this.cartoSource = new carto.source.SQL(sql);
this.layerStyle = new carto.style.CartoCSS(layerStyle);
this.layer = new carto.layer....
2
votes
1
answer
149
views
What is difference between carto.js and cartoDB?
I am exploring how to use carto.js map in a web application. I had seen couple of samples where carto.JS is used and some of them used cartoDB by including a supporting js file in the document.
What ...
2
votes
1
answer
283
views
Using CARTO in a different language (multilanguage)?
Is it possible to configure CARTO, CARTO Builder, etc to be available in different languages e.g. Spanish, French, Portuguese?
1
vote
1
answer
106
views
Display query result in a table
How can I retrieve the result of a SQL query from a source?
I would like to create a dynamic table that displays the result of a query.
const source= new carto.source.SQL('SELECT cartodb_id, ...
0
votes
1
answer
91
views
Can I use external map data with cartojs library? [closed]
I am receiving data from another source apart from cartodb and I would like to use the data for carto maps.
0
votes
1
answer
600
views
Zoom to selected feature extent using Carto and Leaflet
I am trying to use the getBounds and setBounds functions to zoom to the extent of a selected polyline feature in Carto. The feature has been selected using an SQL query. I want to zoom to the extent ...
0
votes
1
answer
87
views
CARTO Airship widget default text
I am testing CARTO Airship. I have a query regarding airship widget default text. There are some default text values in all widgets like "There is no data to display" or "NO DATA AVAILABLE". I also ...
1
vote
1
answer
582
views
Using panel info instead of infowindow with CartoDB?
I am using CartoDB API to develop a map viewer and I would like to get the information from featureClick into a content panel instead of the typical infowindow. Is there any method to do it directly? ...
1
vote
1
answer
554
views
Using CartoDB to detect user location and put dot on map? [closed]
I have a CartoDB question.
We have a project we are piloting in Rio das Pedras, Brazil, a favela near Rio.
We have sampling points, working on adding Fulcrum photo uploads and some pretty bad road ...
2
votes
1
answer
920
views
Is there a way to access the 'data' from the cartodb.createLayer function?
Can I access the data portion of the SQL queries used in the cartodb.createLayer function without the use of special event handlers?
I am making a choropleth map, and categorizing the data with Jenks ...
1
vote
1
answer
479
views
Displaying json into table using Carto?
I am new to cartodb and i don't understand how to populate a bootstrap table with my json data retreived using sql.execute:
sql.execute("SELECT sonde.the_geom,sonde.nom,sonde_data.time,sonde_data.cod,...
0
votes
1
answer
913
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
1
answer
116
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
1
answer
47
views
Reprojection not generating tiles properly
I am executing this query with cartodb.js. I am moving the markers randomly to generate a new layer.
cartodb.createLayer(map, {
user_name: 'mickemr',
type: 'cartodb',
sublayers: [{...
0
votes
1
answer
1k
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
1
answer
157
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
1
answer
119
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
1
answer
95
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
2
answers
880
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
2
answers
398
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 ...
1
vote
1
answer
92
views
Using JavaScript and cartodb.js to get layer's total amount of visible data in certain moment?
I am working with a torque layer and I would like to know for each moment the amount of data points shown in the visualization.
0
votes
1
answer
223
views
Using data from my cartodb in my search box
I would like to use the data on my cartodb in the search function using SQL API. Please help me understand what is missing form my code because when i use my search, i get this error:-
(Bad Request)...
1
vote
1
answer
70
views
Strange cartodb infowindow behavior
I have been working with some cartodb infowindows and some dynamic templating in showing the infowindows when hovering. Sadly when hovering on different sublayers, interactivity of the different ...
0
votes
1
answer
207
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 ...
1
vote
1
answer
79
views
Grab set of datapoints for each step for CartoDB torque timeSlider (through JavaScript)
So I have a regular CartoDB map that has a torque layer with a timeSlider. I know how to access the date for the slider object, but is there a way to access the datapoints for each step as it goes ...
1
vote
1
answer
550
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 ...
1
vote
1
answer
83
views
Buttons that toggle different column visualizations?
I have a census data table in Carto and I want the end user to be able to toggle through several different demographic visualizations via buttons on the map.
For example one button shows median age, ...
0
votes
1
answer
112
views
Carto legend colours not showing in embed?
Carto legends are showing no colours in the bullets after manually adjusting colours in the HTML window -- but only in IE. No issue in other browsers. Has anyone else seen this?
0
votes
1
answer
101
views
Cartodb not loading layers on IE8-10 on longer requests
Check the demo here: http://unirazz.com/cartodb/cartodb1.html
After map is loaded, click on GO button to load cartodb layers. It works in latest browsers excepts IE8-10. If I reduce the length of ...