Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@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
Last active March 9, 2024 19:36
Leaflet simple marker
<!doctype html>
<html>
<head>
<title>Exemple de Leaflet sans Browserify</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<style type="text/css">
#map { height: 380px; }
</style>
@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 / shapely2D_to_3D.py
Last active January 9, 2020 08:58
Just one method to convert 2D to 3D geometry with shapely
# -*- coding: utf-8 -*-
from shapely.geometry import LineString
from shapely import wkt
line = LineString([(0, 0, 5), (1, 1, 5)])
# memo for 3D
wkt3D = line.wkt
# 2D
@ThomasG77
ThomasG77 / index.html
Last active November 20, 2018 10:33
JSTS options with OpenLayers 3
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Buffer example</title>
<link rel="stylesheet" href="https://rawcdn.githack.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<link rel="stylesheet" href="https://rawcdn.githack.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.css" type="text/css">
<style>
html, body {
height: 100%;
@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

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Jsonix WMS</title>
<script src="https://cdn.jsdelivr.net/gh/highsource/jsonix@master/dist/Jsonix-min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highsource/w3c-schemas@master/scripts/lib/XLink_1_0.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highsource/ogc-schemas@master/scripts/lib/WMS_1_1_1.js"></script>
</head>
<body>
OpenLayers.Layer.D3 = OpenLayers.Class(OpenLayers.Layer.Vector, {
d3FeaturesNodeClass:'d3features',
d3Features:[],
afterAdd:function(){
var self = this;
if(this.renderer.CLASS_NAME.match(/SVG$/)){
this.d3InitSVG();
this.events.register('moveend',this,this.onMoveEnd);
@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">
@ThomasG77
ThomasG77 / index.html
Created June 16, 2015 15:47
Sample to display GeoJSON as cluster in Openlayers 3. derived from http://openlayers.org/en/v3.6.0/examples/cluster.html?mode=advanced
<!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>