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 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 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:17
JavaScript: Using markers with Torque

On this style example we load a Torque layer that uses a SVG marker. This option is at this moment not available at the CartoDB editor so you need to edit the layer CartoCSS after selecting your options.

@jsanz
jsanz / README.md
Last active April 19, 2017 15:21
CLI geocode with the Mapzen Search API bash

Small utility to geocode using the nice Mapzen Search geocoder.

This tool simply encodes the first argument and passes it to curl. The result is passed to jq to extract the first result and then using json2csv converts the array result into a couple of coordinates.

So using it is as easy as:

% geocode.sh "valencia"
"Valencia, Municipio Valencia, Venezuela",-68.00765,10.16202,0.947
% geocode.sh "valencia,spain"
@jsanz
jsanz / index.html
Last active December 29, 2015 23:05
CartoDB.js named map with custom infowindo (mustache)
<!DOCTYPE html>
<html>
<head>
<title>Named Maps Tutorial | 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 December 29, 2015 22:19
CartoDB.js named map with custom infowindow
<!DOCTYPE html>
<html>
<head>
<title>Named Maps Tutorial | 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 / README.md
Last active December 17, 2015 11:14
Using fields on infowindows styling

Default CartoDB infowindows are rendered using moustache.js templates. The variables you can pass are normally used to render data on the infowindow but you can also use them on other parts of the markup, like using them as CSS property styles to apply to element sizes or colours.

On this map, the infowindow show the percentage of votes of the three most voted parties by municipality. Apart from showing the result as a number, and thanks to some SQL juggling (check the complete query on this cdb-fiddle) you can also have a bar with the representative color of the party and a proper width.

See below the details of the infowindow templat

@jsanz
jsanz / README.md
Last active December 7, 2015 09:46
Taller Elecciones 2015

Taller mapas electorales con CartoDB

En este taller se describe el proceso de creación de diversos mapas electorales con CartoDB, enfocado sobre todo al tratamient o de los datos y las reglas de simbolización cartográfica.

http://bit.ly/cdb-elecciones-151203

Contacto:

@jsanz
jsanz / README.md
Last active November 24, 2015 19:27 — forked from andy-esch/README.md
Elections webinar
@jsanz
jsanz / README.md
Last active May 19, 2018 21:12
CartoDB training script

CartoDB users training

First session: Introduction to CartoDB

Thi session is oriented for unexperienced users on CartoDB. It will also present a short introduction to the platform as well as their main components and principal use cases.

Overview:

  • Upload and data management
  • Editing and querying data on the platform