CartoDB.js released into the wild


Elevate your online geospatial development with CartoDB.js beta release! Unified mapping, continuous improvement, full control, and minimal latency.

This post may describe functionality for an old version of CARTO. Find out about the latest and cloud-native version here.
CartoDB.js released into the wild

For some months now we have been developing a new  more powerful, and easy to use JavaScript library for CartoDB. Today, we are announcing the beta release of CartoDB.js for all of you to use. While some of you have caught wind and started development with the library early  for the rest, we want to take a moment to go over some of the key benefits of switching to CartoDB.js for your online geospatial development.

Continuous improvement

CarotDB.js was developed so developers could build awesome websites and so we could build maps in the CartoDB platform. That's right, we use CartoDB.js for our administrative dashboards, embedded maps, and all the mapping tools in your account. This means that we are constantly testing it and pushing it for better performance, reliability, and power; it also means that each improvement we make will immediately become available to you as a developer. As you may have read in the announcement of CartoDB 2.0, we are going to be pushing new visualization methods over the coming months, each of which will be available straight away through the CartoDB.js library. Torque for example will be available inside the library soon.

Unification of mapping libraries

Previously, developers using CartoDB were offered CartoDB-GmapsV3 or CartoDB-Leaflet, to use differently depending on the slippy map they wanted on their site. Now  we have efficiently wrapped all the functionality of both tools into a single library. This is great if you are developing multiple maps online or if you want the flexibility to change your map in the future. The mapping functions exposed by CartoDB.js work seamlessly from one map to the next. This officially deprecates the CartoDB-GmapsV3 and CartoDB-Leaflet libraries. We have also made CartoDB.css available  which gives you out of the box CSS for your maps and infowindows and can help greatly reduce development time.

Better support of CartoDB visualizations on websites

As we said above, CartoDB.js works closely with your hosted account. CartoDB.js makes use of a Viz.JSON file, served for each map created within your CartoDB account. The Viz.JSON file documents the style and any filters you apply to your maps. For example, when you create a choropleth using your online account, it can be replicated with only a couple lines using CartoDB.js and your Viz.JSON URL.

Same full control that you have always had

Just because CartoDB.js can pull stored visualizations from your CartoDB account with ease doesn't mean you have to use it that way. Just like the old libraries, you can apply SQL and CartoCSS directly from the client  meaning endless variations and customizations of the data you store on CartoDB. In fact, the library makes it easier than ever to set custom parameters at runtime or to change and update those parameters programatically in response to your website.

Minimal latency means faster websites

We have been working to improve the performance CartoDB everywhere! As part of that mission, we are making CartoDB.js available on a content delivery network (CDN). This means that no matter where in the world your website’s viewers are, they will get CartoDB in their browser as fast as possible. It also means that you don't need to store and update the library on your own server each time you develop a new map, it is all up in the cloud just waiting for you!

Link directly to your version of choice

There is nothing worse than having someone else's library break something you worked hard on. For that reason, not only is the main release of CartoDB.js available on the CDN, but every CartoDB.js version we push will be available for use. While your project is in development, you can link directly to the latest release, but when you go live you can perminantly link to the latest release that you have tested in you website. It is as simple as adding a version number to the URL when importing the CartoDB.js library. Releasing CartoDB.js with version numbers will also help us report, track, and communicate bugs and features with you!

It's in beta  so don't be bashful

Anytime you release a tool in beta, it means you feel good about what you have developed but know somebody is going to find an edge case or a quirky behaviour. We're ready for that! Please report your bugs and questions to our user thread. We are going to be working quickly to fix anything you might find!

Examples using CartoDB.js

CartoDB Hobbit Map

We are very proud of CartoDB.js and all the possibilities it offers. We will be adding more examples and a closer look at some of the library’s features here in the future. For now, take a look at the Hobbit map we released! Dig into the source code and see CartoDB.js in action.