Skip to content

Instantly share code, notes, and snippets.

View jsanz's full-sized avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
@jsanz
jsanz / README.md
Last active December 1, 2017 19:27
JavaScript CartoDB.js: Remove layer from GMaps

On this example we add and remove a layer from a Google Maps Instance.

The thing is you need to explicitely disable the interaction and then execute the off() method in order to completely detach the layer from the map object, otherwise events will still be triggered and you'll have more than one infowindows and several log lines on the console.

@jsanz
jsanz / README.md
Last active September 14, 2016 09:15
JavaScript CartoDB.js: Leaflet map without any interaction

Following this GIS SE answer, on this example I remove all interaction on the map so the zoom, panning and any other events are not fired.

@jsanz
jsanz / README.md
Last active September 14, 2016 09:14
SQL: JOIN by proximity

Joining two point datasets using distance as the relation between them.

@jsanz
jsanz / index.html
Last active April 3, 2016 12:10 — forked from ernesmb/index.html
Training: createVis()
<!DOCTYPE html>
<html>
<head>
<title>Training | createVis | CartoDB</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 {
@jsanz
jsanz / index.html
Last active June 22, 2017 13:48 — forked from ernesmb/index.html
Training: createLayer single LayerSourceObject
<!DOCTYPE html>
<html>
<head>
<title>Training | createLayer | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<style>
@jsanz
jsanz / index.html
Last active April 3, 2016 10:26 — forked from ernesmb/index.html
Training: Actions on feature click
<!DOCTYPE html>
<html>
<head>
<title>Training | feature Click | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<style>
@jsanz
jsanz / index.html
Last active April 3, 2016 12:10
Training: custom infowindow
<!DOCTYPE html>
<html>
<head>
<title>Training | custom infowindow | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<style>
@jsanz
jsanz / index.html
Last active April 3, 2016 12:09
Training: custom tooltip
<!DOCTYPE html>
<html>
<head>
<title>Training | custom tooltip | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<style>
@jsanz
jsanz / index.html
Last active April 3, 2016 12:09 — forked from ernesmb/index.html
Training: changing SQL query and CartoCSS
<!DOCTYPE html>
<html>
<head>
<title>Training | change SQL and CartoCSS | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
@jsanz
jsanz / index.html
Created April 3, 2016 12:09
Training: change SQL with slider
<!DOCTYPE html>
<html>
<head>
<title>Training | Change SQL with slider | 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" />
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<style>