Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gratier ThomasG77

View GitHub Profile
View 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 Aug 29, 2015
Minimum fabfile.py to connect to Vagrant
View fabfile.py
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 Nov 10, 2014
GBIF OpenLayers 2
View index.html
<!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 Aug 29, 2015
Minimum demo to use browserify with ol3
View README.md

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
View index.html
<!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">
@ThomasG77
ThomasG77 / index.html
Created Jun 16, 2015
Sample to display GeoJSON as cluster in Openlayers 3. derived from http://openlayers.org/en/v3.6.0/examples/cluster.html?mode=advanced
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Clustering example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.6.0/ol.css" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.6.0/ol.js"></script>
View DCNeighborhoodBoundariesWaPo.geojson
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 Aug 29, 2015
Use OpenLayers 3 with TSV through GeoJSON
View index.html
<!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>
View villes-arrondissements-sup-100000habs-france.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.