Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@ThomasG77
ThomasG77 / README.md
Last active August 29, 2015 14:08 — forked from wrobstory/README.md

A Leaflet.js map created with Folium and a custom D3 threshold scale, with data bound between the Pandas DataFrame and the TopoJSON. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map_3 = folium.Map(location=[40, -99], zoom_start=4)
map_3.geo_json(geo_path=county_geo, data_out='data3.json', data=df,
               columns=['GEO_ID', 'Median_Household_Income_2011'],
               key_on='feature.id',
               fill_color='PuRd', line_opacity=0.3,
               legend_name='Median Household Income 2011 ($)',
 topojson='objects.us_counties_20m')
@ThomasG77
ThomasG77 / fabfile.py
Last active August 29, 2015 14:08
Minimum fabfile.py to connect to Vagrant
from fabric.api import env, sudo, local, run
def vagrant():
# change from the default user to 'vagrant'
env.user = 'vagrant'
# Get config from vagrant ssh-config output
result = dict(line.split() for line in local('vagrant ssh-config', capture=True).splitlines())
# connect to the port-forwarded ssh
env.hosts = ['%s:%s' % (result['HostName'], result['Port'])]
@ThomasG77
ThomasG77 / index.html
Created November 10, 2014 11:19
GBIF OpenLayers 2
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Basic OSM Example</title>
<link rel="stylesheet" href="http://dev.openlayers.org/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://dev.openlayers.org/examples/style.css" type="text/css">
<script src="http://dev.openlayers.org/OpenLayers.js"></script>
@ThomasG77
ThomasG77 / README.md
Last active August 29, 2015 14:14
Minimum demo to use browserify with ol3

To test

Clone the gist and cd into the dir

git clone https://gist.github.com/ThomasG77/7a92c94c6d7955fe81c9 demo_browserify_ol3
cd demo_browserify_ol3

Run NPM

npm install

@ThomasG77
ThomasG77 / index.html
Created June 7, 2015 22:54
Exemple SVG
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Exemple SVG</title>
<style></style>
<script></script>
</head>
<body>
<svg height="600" width="800">
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ThomasG77
ThomasG77 / index.html
Last active August 29, 2015 14:25
Use OpenLayers 3 with TSV through GeoJSON
<!DOCTYPE html>
<html>
<head>
<title>Vector layer example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.7.0/ol.css" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.7.0/ol.js"></script>
<script src="https://rawgit.com/tmcw/csv2geojson/gh-pages/csv2geojson.js"></script>
</head>
<body>
<div id="map" class="map"></div>
@ThomasG77
ThomasG77 / villes-arrondissements-sup-100000habs-france.csv
Last active August 29, 2015 14:25
Villes ou arrondissements > 100 000 habitants en France
NOM_COM STATUT SUPERFICIE POPULATION latitude longitude result_label
TOULOUSE Préfecture de région 11809 447340 43.604268 1.441019 Toulouse
NICE Préfecture de département 7392 344064 43.701875 7.267464 Nice
NANTES Préfecture de région 6578 287845 47.216354 -1.554456 Nantes
STRASBOURG Préfecture de région 7810 272222 48.583530 7.746735 Strasbourg
MONTPELLIER Préfecture de région 5712 264538 43.611024 3.875521 Montpellier
BORDEAUX Préfecture de région 4970 239399 44.837663 -0.579717 Bordeaux
PARIS-15E-ARRONDISSEMENT Commune simple 846 238395 48.840698 2.299681 15e Arrondissement
LILLE Préfecture de région 3499 227533 50.631564 3.056440 Lille
RENNES Préfecture de région 5036 208033 48.113844 -1.681632 Rennes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.