Skip to content

Instantly share code, notes, and snippets.

Javier de la Torre jatorre

Block or report user

Report or block jatorre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jatorre
jatorre / gist:6622239
Last active Dec 23, 2015
Small update example optimized
View gist:6622239
UPDATE wahlen_by_2013_test o
SET averagevalue=n.averagevalue,
constituencyname=n.constituencyname,
electionwinnerpartyname1=n.electionwinnerpartyname1,
electionwinnerpartyname2=n.electionwinnerpartyname2,
electionwinnerpartypercent1=n.electionwinnerpartypercent1,
electionwinnerpartyperson1=n.electionwinnerpartyperson1,
freie_waehler_percent2=n.freie_waehler_percent2,
gruene_percent2=n.gruene_percent2,
piraten_percent2=n.piraten_percent2,
@jatorre
jatorre / gist:6222402
Last active Dec 21, 2015
Here is a bit better
View gist:6222402
#locales_de_votaci_n_paso_2013_caba[vot_parcodigo=8] {::shadow {
marker-opacity: 1;
marker-allow-overlap: true;
marker-line-width: 0;
marker-line-opacity: 0;
image-filters: agg-stack-blur(5,5);
marker-fill: #2ca02c; [zoom<=12] {
marker-width: 8;
}
[zoom=13] {
View gist:5885430
./cdb_import.sh <cdb_username> <api_key> <file_name>
View gist:5773840
TMSMapLayer cartoDbTileLayer = new TMSMapLayer(new EPSG3857(), 0, 18, 15,
”http://nutiteq.cartodb.com/tiles/tm_world_borders/”, “/”, “.png”);
mapView.getLayers().addLayer(cartoDbTileLayer);
@jatorre
jatorre / gist:5773783
Created Jun 13, 2013
Example for Nutiteq
View gist:5773783
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.nutiteq.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
View gist:5773824
// define new configuration holder object
mapView.setComponents(new Components());
// Define base layer. Here we use MapQuest open tiles which are free to use
// Note that almost all online maps use EPSG3857 projection, but Nutiteq SDK supports also other projections if needed
TMSMapLayer mapLayer = new TMSMapLayer(new EPSG3857(), 0, 18, 0,
"http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png");
mapView.getLayers().setBaseLayer(mapLayer);
View gist:5773850
LineStyle lineStyle = LineStyle.builder().setWidth(0.05f).setColor(Color.WHITE).build();
PolygonStyle polygonStyle = PolygonStyle.builder().setColor(0xFFFF6600 & 0x80FFFFFF).setLineStyle(lineStyle).build();
StyleSet<PolygonStyle> polygonStyleSet = new StyleSet<PolygonStyle>(polygonStyle);
// note the SQL has special string !bbox! as bounding box dynamic value placeholder
String sql = "SELECT name,iso2,pop2005,area,the_geom_webmercator FROM tm_world_borders WHERE the_geom_webmercator && ST_SetSRID('BOX3D(!bbox!)'::box3d, 3857) LIMIT 3000";
CartoDbVectorLayer cartoLayer = new CartoDbVectorLayer(new EPSG3857(), "nutiteq", sql, null, null, polygonStyleSet);
mapView.getLayers().addLayer(cartoLayer);
@jatorre
jatorre / gist:5773807
Created Jun 13, 2013
Nutiteq CartoDB example
View gist:5773807
public class HelloMap3DActivity extends Activity {
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
// now start init of MapView, see below...
View README.md

Source: American Community Survey, 2011 5-Year Estimate

This map was inspired by a similar map found on Wikipedia. I wasn’t wild about the diverging color scale, so I thought it would be a fun challenge to recreate.

Finding the shapefiles was easy; I used the U.S. National Atlas 1:1,000,000 scale dataset, conveniently packaged in my U.S. Atlas repository. I reprojected the shapefiles to the California Albers projection using ogr2ogr:

ogr2ogr \
	-f 'ESRI Shapefile' \
	-t_srs 'EPSG:3310' \
@jatorre
jatorre / gist:5514912
Created May 3, 2013
Example of a Google Spcripting language program to insert data from a Google Form, georeference it and insert it on CartoDB.
View gist:5514912
function onFormSubmission(e) {
//Georeference the submission
var loc = geocode(e.namedValues.location);
postToCartoDB(
e.namedValues.location,
e.namedValues.sport,
loc.lat,
loc.lng
You can’t perform that action at this time.