Skip to content

Instantly share code, notes, and snippets.

@giohappy
giohappy / mapblender.py
Created June 16, 2017 16:44
mapblender.py
#!/usr/bin/env python
import os
import sys
from optparse import OptionParser
from collections import OrderedDict
from osgeo import gdal
import numpy as np
from PIL import Image
from matplotlib.colors import LinearSegmentedColormap
@giohappy
giohappy / webservice_output.txt
Created November 15, 2016 08:57
ISIDE output
#EventID|Time|Latitude|Longitude|Depth/Km|Author|Catalog|Contributor|ContributorID|MagType|Magnitude|MagAuthor|EventLocationName|web_id_locator(deprecated)
4730151|2014-12-20T22:37:25.350000|43.6097|11.2563|6.7|SURVEY-INGV||||ML|2.6|SURVEY-INGV|Firenze|4004730151
4730041|2014-12-20T22:35:09.980000|43.5848|11.2553|10.2|SURVEY-INGV||||ML|2.0|SURVEY-INGV|Firenze|4004730041
4729881|2014-12-20T22:25:33.310000|43.6218|11.2432|7.4|SURVEY-INGV||||ML|2.2|SURVEY-INGV|Firenze|4004729881
4729581|2014-12-20T21:39:40.560000|43.6218|11.2445|5.7|SURVEY-INGV||||ML|2.3|SURVEY-INGV|Firenze|4004729581
@giohappy
giohappy / export_wkt.py
Created October 29, 2015 17:18
QGIS script for Processing to export WKT geometry representation
##Geometry=group
##Export WKT to file=name
##Input_Layer=vector
##Output_File=output file
from qgis.core import *
from PyQt4.QtCore import *
import processing
v_in = processing.getObject(Input_Layer)
@giohappy
giohappy / webviewgl.qml
Created February 11, 2015 14:57
WebView with WebGL
import QtQuick 2.0
import QtWebKit 3.0
Rectangle {
width: 800
height: 600
WebView {
url: "http://stemkoski.github.io/Three.js/Model-Animation.html";
anchors.fill: parent
}
@giohappy
giohappy / lengthalongline.py
Last active September 29, 2015 14:54
Lenght along linestring to point
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Giovanni Allegri (Gis3W s.a.s.)
# Licensed under the terms of the LGPLv2 License
from qgis.core import *
import math
def pointInterpolate(geom,point):
geomType = geom.wkbType ()
curl -s "http://webservices.rm.ingv.it/fdsnws/event/1/query?lat=43.587007&lon=11.316179&maxradiuskm=30&starttime=2014-12-19T00:00:00&endtime=2014-12-20T23:59:59&minmag=2&maxmag=5" | xml2json | jq "[.\"q$quakeml\".eventParameters.event[] | {latitude:.origin.latitude.value[],longitude:.origin.longitude.value[],magnitude:.magnitude.mag.value[]}]" | in2csv -f json | csvjson --lat latitude --lon longitude | jq . > output.json