Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a table in CartoDB containing some points. I want to render these points dynamically with Leaflet. There is cartodb.js for such tasks, but it does not support full customization of Tooltips, as I have seen. Instead I found a Leaflet-Plugin for that.

In my HTML I have the following JS-Code, but it does not work except showing the Base Map. What am I doing wrong? Are there other solutions for Leaflet?

var map = new L.Map('map').setView([51.0, 10.0], 6);
var defaultLayer = L.TileLayer.provider('MapQuestOpen.OSM');

var baseLayers = {
"Mapquest OSM": defaultLayer,
"OpenStreetMap German Style": L.TileLayer.provider('OpenStreetMap.DE'),

// Use Leaflet Vector Layers plugin to show data from CartoDB

var cartodblayer = new lvector.CartoDB({
    user: "user",
    table: "example_data",
    scaleRange: [6, 20],
    symbology: {
        vectorOptions: {
            icon: new customIcon({
                iconUrl: "/icon/icon.png"
    popupTemplate: '<p>{homepage}</p>',
    singlePopup: false


map.addControl(new L.Control.Layers(baseLayers, '', {collapsed: true}));
share|improve this question
as I am working with @leak_my_brain: I have written an article about this:… – Riccardo Jun 25 '13 at 18:57
up vote 1 down vote accepted

you can query cartoDB to get the points in GeoJSON format like this:

http://{account} * FROM {table_name}

You will get a featurecollection looking something similar to this:

{"type":"FeatureCollection","features":[{"type":"Feature","properties":    {"cartodb_id":58,"name":xxx,"email":xxx,"created_at":"2011-03-20T09:44:38Z","updated_at":"2011-09-09T12:39:42Z","ncuser":1311468667},"geometry":{"type":"Point","coordinates":[8.705274,50.607916]}},...

then you parse that using leaflet as described here:

and customize your infowindow using CSS

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.