Skip to content

Instantly share code, notes, and snippets.

View RCura's full-sized avatar

Robin Cura RCura

View GitHub Profile
@RCura
RCura / gist:1717699
Created February 1, 2012 15:59
script de correction des tableaux
import csv
import os
print "debut"
for nbReseau in range(8):
for nbSimulation in range(10):
print "reseau " + str(nbReseau + 1) + " / Simulation : " + str(nbSimulation + 1)
inFilePath = "/home/administrateur/experiences/reseau_" + str(nbReseau + 1) + "-exp_" + str(nbSimulation + 1) + "_links-traffic.csv"
inFile = open(inFilePath)
inCsv = csv.reader(inFile)
linksTable = new Array
(
{'from': 12, 'to': 4},
{'from': 11, 'to': 9},
{'from': 11, 'to': 22},
{'from': 9, 'to': 22},
{'from': 23, 'to': 1},
{'from': 16, 'to': 19},
{'from': 16, 'to': 28},
{'from': 16, 'to': 34},
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
var gAxesTable = null ;
var gMembersTable = null ;
google.load("visualization", "1");
// Set callback to run when API is loaded
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
var gAxesTable = null ;
var gMembersTable = null ;
google.load("visualization", "1");
// Set callback to run when API is loaded
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html>
<script type="text/javascript">
var testvar = 'JIHIBNBUI';
function test()
{
document.getElementById('result').innerHTML = testvar;
};
function concatenateTables(table1, table2, columnsNameList)
{
gNewTable = new google.visualization.DataTable();
//alert(columnsNameList);
for (i in columnsNameList)
{
gNewTable.addColumn('string', columnsNameList[i], columnsNameList[i]);
};
// alert(gNewTable.toJSON());
def selfIntersection(x, y):
"""
ATTENTION A NE PAS LANCER LE TEST SUR DES GEOMETRIES INFERIEUR A TROIS COORDONNEES DISTINCTES
"""
print x, y
for i in xrange(len(x)-1):
xSeg1 = [x[i], x[i+1]]
ySeg1 = [y[i], y[i+1]]
seg1 = guilabs.createGeometry(2, xSeg1, ySeg1)
for j in xrange(i + 2, len(x)-3):
@RCura
RCura / remove_csv_column.py
Created November 12, 2012 15:23
Script Python (pour Emeric) pour supprimer une colonne d'un CSV
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 19 20:58:18 2012
@creation : 2012-07-19
@author : Robin Cura
@email : robin.cura@gmail.com
"""
# Chemin vers le CSV à traiter
@RCura
RCura / python_step4_qgis.py
Created November 13, 2012 17:53
Stats zonales
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 16:30:23 2012
@author: robin
"""
from qgis.core import *
from qgis.analysis import *
import time
@RCura
RCura / python_step3_ogr.py
Created November 14, 2012 07:47
Ogr split by attribute
# -*- coding: utf-8 -*-
from osgeo import ogr
roadShpPath = "D:\\DonneesM2\\UMZ_2000_Cut.shp"
fieldToUse = 'Type'
driver = ogr.GetDriverByName("ESRI Shapefile")
datasource = driver.Open(roadShpPath)
layer = datasource.GetLayer()