Skip to content

Instantly share code, notes, and snippets.

View quommit's full-sized avatar

José Tomás Navarro Carrión quommit

View GitHub Profile
@quommit
quommit / configure-schema.py
Last active June 1, 2018 08:51
GRASS 7 Python script for configuring polygon shapefile attributes using SIGUA schema
#!/usr/bin/env python
#%module
#% description: configure attributes using SIGUA schema
#%end
#%option
#% key: input
#% type: string
#% description: Input building floor polygon shapefile
#% required: yes
@quommit
quommit / clean.py
Last active February 11, 2019 10:59
Simple topology cleaning Python script for GRASS 7
#!/usr/bin/env python
#%module
#% description: topology cleaning geoprocess
#%end
#%flag
#% key: o
#% description: Overwrite existing maps
#%end
#%option
@quommit
quommit / geomchange_plpgsql
Last active August 29, 2015 14:16
PostgreSQL trigger function for geometry change notification
CREATE OR REPLACE FUNCTION redis_pubsub.notifygeometrychange_trigger()
RETURNS trigger AS
$BODY$
DECLARE
message text;
geom geometry;
xmin double precision;
ymin double precision;
xmax double precision;
ymax double precision;
@quommit
quommit / redispub_plpython
Created March 5, 2015 13:16
Simple PostgreSQL plpython function for message publication through Redis pub/sub
CREATE OR REPLACE FUNCTION redis_pubsub.notify(channel text, message text, host text, port integer)
RETURNS void AS
$BODY$
#Safeguard against null or empty values
if (channel is None) or (message is None):
return
if (host is None) or (host.strip() == ""):
redishost = "127.0.0.1"
else:
redishost = host
@quommit
quommit / cat2redis
Last active August 29, 2015 14:10
Generar Nomenclator de referencias catastrales en Redis
from argparse import ArgumentParser
import os
from lxml import etree
import redis
EXEC_DIR = os.path.dirname(__file__)
root = "/home/josetomas/Descargas/catastro_alicante_2014"
gmdns = "{http://www.isotc211.org/2005/gmd}"
@quommit
quommit / gist:7320755
Created November 5, 2013 15:28
How to create a hash using ServiceStack.Redis
using System;
using System.Globalization;
using System.Collections.Generic;
using ServiceStack.Redis;
using ServiceStack.Redis.Generic;
using ServiceStack.Text;
using System.Linq;
namespace redisw
{
@quommit
quommit / gist:4633786
Last active April 19, 2017 06:04
C# routing application for calculating a set of shortest paths from a series of predefined start and end locations. Each start node can be assigned an integer load value which accumulates on its corresponding end node. In order to compile this code, download and reference NetTopologySuite, an open source spatial analysis library, and QuickGraph,…
using System;
using System.Collections.Generic;
using System.IO;
using GeoAPI.Geometries;
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using System.Globalization;
namespace ShortestPath
@quommit
quommit / gist:4605854
Last active July 25, 2022 19:31
Sample C# code implementing medial axis transform of a polygon using Voronoi diagram. In order to compile this code, download and reference NetTopologySuite, an open source spatial analysis library.
using System;
using System.Collections.Generic;
using GeoAPI.Geometries;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using NetTopologySuite.Densify;
using NetTopologySuite.Triangulate;
namespace Skeleton
{
@quommit
quommit / gist:4605752
Created January 23, 2013 13:45
Pseudo-code for a medial axis transform algorithm based on Voronoi diagram.
//Get point cloud S from polygon P
//by running a densify operation
var S = P.Densify ();
//Create Voronoi diagram V for
//point cloud S
var V = Voronoi (S);
//Get intersection C of Voronoi diagram V
//with polygon P
@quommit
quommit / gist:4596403
Last active November 8, 2022 10:51
Sample C# code for indexing a series of polygon vertices using Z-order. In order to compile this code, download and reference NetTopologySuite, an open source spatial analysis library.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using GeoAPI.Geometries;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using NetTopologySuite.Densify;
namespace MortonOrder