Skip to content

Instantly share code, notes, and snippets.

@javisantana
javisantana / index.html
Created January 27, 2015 15:44
bing maps in cartodb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Bing Maps + CartoDB.js</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
html, body, #myMap{
height: 100%;
padding: 0;
margin: 0;
@javisantana
javisantana / index.html
Created January 16, 2015 14:41
retina_basemap_cartodb.html
<!DOCTYPE html>
<html>
<head>
<title>Leaflet example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@javisantana
javisantana / index.html
Created December 18, 2014 12:10
cartodb tooltip with createLayer
<!DOCTYPE html>
<html>
<head>
<title>Leaflet example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@javisantana
javisantana / cartodb_yosemite.md
Created December 9, 2014 14:08
installing cartodb on OSX yosemite

cartodb installation on yosemite

if you get the following when you are running bundle on OSX Yosemite:

An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.

Backbone basics

4 elements to indetify

  • model / view
  • collection / view collection

model

WITH a as (
select zoom('!scale_denominator!') as current_zoom
)
SELECT the_geom_webmercator from roads, a where current_zoom < 8 AND type='Interstate'
UNION
SELECT the_geom_webmercator from roads, a where current_zoom >= 8 AND current_zoom < 12 AND (type='Interstate' OR type='US')
UNION
SELECT the_geom_webmercator from roads where current_zoom >= 12
@javisantana
javisantana / index.html
Created October 22, 2014 04:37
highlight polygon on click with leaflet and cartodb.js
<!DOCTYPE html>
<html>
<head>
<title>Leaflet example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
/**
* track changes and sync on every model
*/
function instrumentBackbone() {
var events = [];
var eventMap = {}
instrumentBackbone.events = events;
EVENT_SET = "SET";
EVENT_SYNC = "SYNC";
@javisantana
javisantana / index.html
Last active February 23, 2016 13:41
example loading multiple layers from cartodb in a leaflet map
<!DOCTYPE html>
<html>
<head>
<title>Leaflet example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@javisantana
javisantana / index.html
Created September 4, 2014 12:26
add a search box
<!DOCTYPE html>
<html>
<head>
<title>Gmaps example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;