All examples By author By category About

ngocbien

CartoDB.js map and interactive Paris

This example uses the libraries CartoDB.js and d3.js to display two maps that are connected. If you click on the CartoDB map, the d3.js map changed its center.

First a "normal" CartoDB map is created with the cartodb.createLayer() method, but everytime that the map is clicked, the longitude and latitude values are stored in the lat and lon variables. On the other hand, a d3.js map is created by using the d3.geo.orthographic() projection to get the effect of a 3D map of the world.

Everytime that the CartoDB map is clicked, the latitude and longitude coordinates that are get from the "clicked" event are used to change the center of the d3.js map.

forked from oriolbx's block: CartoDB.js map and interactive d3.js earth globe