Skip to content

Instantly share code, notes, and snippets.

@neogis-de
neogis-de / sort_qgis_plugin_loading_times.py
Last active Nov 15, 2016
sort_qgis_plugin_loading_times
View sort_qgis_plugin_loading_times.py
import pprint
import operator
plugin_load_times= qgis.utils.plugin_times
sorted_load_times = sorted(plugin_load_times.items(), key=operator.itemgetter(1))
pprint.pprint(sorted_load_times)
# in addition to: https://gis.stackexchange.com/questions/209129/how-to-tell-which-qgis-plugins-are-slow-to-load?stw=2
# helpt to sort dictionary from: https://stackoverflow.com/questions/613183/sort-a-python-dictionary-by-value
View postgis_trigger.sql
BEGIN;
-------------------------------------------------------
-- CREATE test tables
CREATE TABLE label_point (
gid serial NOT NULL,
geom geometry(point, 3857),
label_sample varchar(255),
@neogis-de
neogis-de / postgis_split_polygons.sql
Created Nov 12, 2015
postgis split polygons with polygons
View postgis_split_polygons.sql
CREATE TABLE public.testpolygons1
(
gid serial PRIMARY KEY,
geom geometry(Polygon,3857)
);
CREATE TABLE public.testpolygons2
(
gid serial PRIMARY KEY,
geom geometry(Polygon,3857)
View OpenLayers.Util.QuickHull.js
OpenLayers.Util.QuickHull = (function() {
var buildConvexHull = function (baseLine, points, allBaseLines) {
var convexHullBaseLines = [],
maxDistance = 0,
maxPoint = [],
newPoints = [],
point, distance, i, vY, vX;
for (i = 0; i < points.length; i++) {
point = points[i];
vY = baseLine[1][0] - baseLine[0][0];
@neogis-de
neogis-de / xyz_vs_tms.md
Created Oct 16, 2015 — forked from tmcw/xyz_vs_tms.md
The difference between XYZ and TMS tiles and how to convert between them
View xyz_vs_tms.md

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@neogis-de
neogis-de / geojson.js
Created Sep 28, 2015
geojson testfile
View geojson.js
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Null Island"
},
"geometry": {
"type": "Point",
@neogis-de
neogis-de / postgis_trigger.sql
Last active Jun 30, 2018
postgis Trigger between polygon and point layer insert update delete ST_Intersection
View postgis_trigger.sql
CREATE TABLE label_point (
gid serial NOT NULL,
geom geometry(point, 3857),
label_sample varchar(255),
CONSTRAINT label_point_pkey PRIMARY KEY (gid)
);
CREATE TABLE soil (
gid serial NOT NULL,
geom geometry(polygon, 3857),
@neogis-de
neogis-de / merge_ordnance_survey.bat
Last active Sep 4, 2015
ogr2ogr merge Ordnance Survey shapefiles from different subfolders together
View merge_ordnance_survey.bat
@echo off
set OSGEO4W_ROOT=C:\OSGeo4W64
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
SETLOCAL ENABLEDELAYEDEXPANSION
rem set your folder which contains the shapefiles and change to this folder:
set verzeichnis=C:\YourShapefileFolder\
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
View gist:89ed173797ab14300fa9
point title description icon
10,20 my orange title my orange description
2,4 my aqua title my aqua description
42,-71 my purple title my purple description