Questions tagged [carto-js]

CARTO.js is a JavaScript library that interacts with different CARTO APIs. It is part of the CARTO Engine ecosystem.

Filter by
Sorted by
Tagged with
1 vote
1 answer
619 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 ...
Sidders's user avatar
  • 81
2 votes
1 answer
347 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&...
Max Hartshorn's user avatar
1 vote
1 answer
125 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 ...
Sam Comber's user avatar
1 vote
3 answers
179 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=...
hashir ilyas's user avatar
1 vote
1 answer
768 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, ...
Sidders's user avatar
  • 81
1 vote
1 answer
381 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 ...
Korl's user avatar
  • 11
1 vote
0 answers
117 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), ...
Michael Mehaffey's user avatar
1 vote
1 answer
135 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 ...
Thort's user avatar
  • 23
0 votes
1 answer
250 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('...
Robin's user avatar
  • 218
0 votes
1 answer
776 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 ...
Stef42530's user avatar
  • 129
2 votes
3 answers
2k views

Is there a way to get a viz.json url from Carto Builder?

Questions for any Carto users/developers here. I am trying to find out a way to a get a viz.json url that can be used as an overlay on a Leaflet map using Carto.js API. However, I can't find it under ...
Amn's user avatar
  • 129
0 votes
1 answer
368 views

Add two sublayers at once Carto.js

How can I have two sublayers on at once in carto.js? I'm very much struggling on how to accomplish this. My code is here, I have gotten so far as to hide and display each sublayer with a checkbox, but ...
moman822's user avatar
  • 125
0 votes
1 answer
167 views

Is it possible to change interactivity in Carto.js map when called from Carto

I am making a carto map using carto.js and a map/data from my Carto account. I know I can set the interactivity there for clicking on polygons, etc. in the wizard, but am not able to alter that in my ...
moman822's user avatar
  • 125
1 vote
1 answer
108 views

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

I want to add GPS UI for getting current location on CARTO public_map and/or embed_map, when they are accessed from mobile phones. I know I can do it coding in JavaScript and carto.js, but I want to ...
kochizufan's user avatar
0 votes
1 answer
218 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)...
Cebo Mbanjwa's user avatar
2 votes
1 answer
131 views

Trouble hosting CARTO data on GitHub

I'm having trouble getting data from a createLayer layer to populate a CARTO map when hosted on GitHub. The map itself draws but the data is missing, although, it works when hosted locally. Also, I am ...
chakrm's user avatar
  • 21
0 votes
1 answer
504 views

Carto.js - Change infowindow field on click event

How can I get fields in an infowindow to change when I click on something? For example, if this is my infowindow code: cartodb.vis.Vis.addInfowindow(map, layer.getSubLayer(0), ['abbrev']) How can I ...
Sidders's user avatar
  • 81
1 vote
1 answer
104 views

Carto Feature Selector

Still a novice in this aspect of GIS. I am trying to get a feature list to select only matching points when clicked. However, I am not sure what I am missing for the query to run correctly. I am ...
Howard Smith's user avatar
0 votes
1 answer
103 views

How to automatically separate two pins when a map is scaled in Carto

I am building a map on Carto, i am mapping activities at building level in a city. Sometimes two activities occur in the same building, when the map is zoomed in (at building level) you can clearly ...
simon's user avatar
  • 1
0 votes
1 answer
276 views

How to spiderfy stacked POIs in CARTO's standard map?

I'm creating this map on CARTO. Some POIs are stacked even at max zoom level, so some POIs are impossible to be clicked. Are there any methods to make these POIs spiderfied?
kochizufan's user avatar
5 votes
2 answers
584 views

Applying https to Carto map but requesting insecure data?

I am building a site using data from CartoDB that locates someone on a map, and Chrome requires that be over https. I added an SSL, but it was not working, the page showed up black. I found out that ...
nittyjee's user avatar
  • 465
1 vote
1 answer
459 views

Add marker interactivity to a carto map

I've got a working example of a map that adds a marker layer with the creatLayer method. I am trying to add a click listener to the carto markers. I have tried the examples here and here to no avail. ...
Justin's user avatar
  • 15
1 vote
1 answer
411 views

Adding a fixed infobox showing an image when clicking on a feature

Each of my data points have a different image. The images are uploaded to a web server and on CARTO I created a column with the url {{image_url}}. This works fine when showing the images on hover ...
Catalina's user avatar
1 vote
1 answer
485 views

Carto - Search for point by name and zoom to

I have a map I've put together with Carto. The main layer is a brewery point layer. I want to set up a search box that allows the map reader to search for a brewery by name. I know I can set up a ...
Kurt Menke's user avatar
1 vote
1 answer
52 views

How to insert basemaps in cartodb.js?

I'm desperately trying to swap out my basemap in cartodb.js. Here's the snippet of code, the part I switched out successfully with some basemaps is in bold: L.tileLayer('https://dnv9my2eseobd....
nittyjee's user avatar
  • 465
0 votes
1 answer
366 views

CARTO DB / Adding images using layer.on('featureClick',function(e,latlng,pos,data)

Each of my data points have a different image. The images are all loaded in CARTO and the column has a name. I need to call each of the images on click event. I've been using the layer.on('...
Catalina's user avatar
0 votes
1 answer
109 views

Torque map slider formatting problem

I tried combining the code in the example below, with my own code but it does not work: the timeslider continues to count up from 0 and does not display the text alongside the number. How to Change ...
Danielle Charlton's user avatar
0 votes
1 answer
111 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?
A.T.'s user avatar
  • 63
2 votes
1 answer
791 views

Infowindow close on featureOut /hoverOut

I have been working on getting infowindows on my cartodb layers, but i am not sure what I am doing wrong as I want the infowindows to automatically close on feature out and only pop up when featurein ...
Jude Mwenda's user avatar
1 vote
1 answer
166 views

CartoDB Infowindow createLayer with Layersource

I replicated an example of a layer with customized infowindows, but when I changed the source to a layer source object, the layers are loaded but the infowindow fails to show up. Any pointers.. http://...
Jude Mwenda's user avatar
1 vote
1 answer
158 views

How do I put infowindow contents into a separate `div`?

I'm new to CartoJS. When a user clicks a dot on my CartoDB map, I want the content of the infowindow to appear in a separate div on the web page. How do I do this with CartoDB/JS?
Username's user avatar
  • 297
1 vote
1 answer
77 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, ...
Michael Bussey's user avatar
1 vote
1 answer
67 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 ...
Jude Mwenda's user avatar
1 vote
1 answer
91 views

How to input an mp3 file into CARTO

I am trying to create a bubble map in CARTO in which a user can click on a bubble and one of the fields that appears is an mp3 file. Alternatively, a soundcloud page with the mp3 could appear with the ...
how to use audio with carto's user avatar
0 votes
1 answer
178 views

Cartodb Layer source object not loading

I have tried to figure out why the layer is not showing up on the map. My code is as follows. var markersLayerSource = { user_name: 'someaccount', type: 'cartodb', sublayers: [{ ...
Jude Mwenda's user avatar
1 vote
1 answer
1k views

Change the size of legend on Cartodb

My legend is too big and it is blocking the view of my map. The size of the map is fixed, so the only solution is to make the legend smaller? Is there any way to do this? <div class='cartodb-...
Geomap's user avatar
  • 89
0 votes
1 answer
367 views

CartoDB- popup window not working

I am working on a project, and I have not worked with cartodb long, but there is something wrong with this code. It is supposed to display a little pop window showing the school district for that ...
Bob's user avatar
  • 1
1 vote
1 answer
1k views

Switching from "layer selector" to buttons to toggle between layers in CartoDB

As of now, we have a map that you can toggle between layers using the "layer selector". We want to instead have buttons on the map that, by clicking on one, you can switch between layers. In our's, ...
zzzzaaaa's user avatar
2 votes
0 answers
105 views

CartoDB.js/Leaflet map - how can I click between multipolygons cleanly?

Here's my map: https://jsfiddle.net/Sidders/4exf969e/3/ I want to apply a click and hover effect to the polygons. So a polygon/multipolygon highlights on hover, and is selected with one click. The ...
Sidders's user avatar
  • 81
0 votes
1 answer
58 views

CartoDB: Trigger InfoWindow from inside another InfoWindow

Is there a easy way (maybe even generic solution) to trigger opening the InfoWindow of Marker 1 from inside the InfoWindow of Marker 0? The goal would be to «jump» from marker to marker right from ...
albuvee's user avatar
  • 173
1 vote
1 answer
353 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 ...
Philip Kahn's user avatar
1 vote
1 answer
356 views

Mustache functions possible in CartoDB tooltip templates?

CartoDB.js uses the mustache.js library to render tooltip windows. One of the features of mustache.js is allows functions to be defined, which are called when the template is rendered. An example is ...
lotophage's user avatar
2 votes
1 answer
461 views

Adding infowindow to cartodb map using api

I think this should be easy, but I just can't work it out. I am building a multi-layer map using cartodb (own opensource server). Layers display well. but I have two problems. 1) the layer select ...
Matt's user avatar
  • 43
-2 votes
1 answer
121 views

CartoDB Point Clustering and on Hover

I have been working from a sample on point clustering from cartodb. I would like to have an infowindow show when someone hovers over a series of points. This infowindow will display a different ...
Jude Mwenda's user avatar
1 vote
0 answers
506 views

Creating Legends in CartoDB?

I'm trying to add a legend to a simple choropleth map using the ui for custom legends. But I'm not sure where to put it in my code, if it should be within the createLayer function, or outside of it, ...
user2220574's user avatar
1 vote
1 answer
709 views

Leaflet display only clicked element of a loaded map layer (polyline)

I am creating a web mapping application that will return appropriate routes based upon ST_length query on a cartoDB dataset. So far, the code below successfully maps those routes with individual ...
Paws's user avatar
  • 137
0 votes
1 answer
241 views

Create Choropleth Style Map in CartoDB programmatically

I am trying to create a choropleth map for a school project I am working on. Based off user input, I will create a csv file that I will then upload to CartoDB using their Import API. By setting the ...
user3699999's user avatar
0 votes
1 answer
75 views

Arguments not working in cartoDB createLayer method

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. ...
andy's user avatar
  • 215
1 vote
0 answers
463 views

Changing layer color with a button click

I am trying to change the color of my map layer when filter buttons are selected. So, the goal is: the user sees all of the data in one color. Then, when they click on a filter button, only a subset ...
user2192778's user avatar
1 vote
1 answer
183 views

Creating a runtime visualization with CartoDb

I am trying to create a runtime visualization for a CartoDB map and I am quite the trouble with doing it. I have gone over the documentation and cannot get the code to work correctly at all unless it ...
Jeff Reed's user avatar