Skip to content

Instantly share code, notes, and snippets.

@neogis-de
neogis-de / sort_qgis_plugin_loading_times.py
Last active November 15, 2016 16:15
sort_qgis_plugin_loading_times
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
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 November 12, 2015 09:09
postgis split polygons with polygons
CREATE TABLE public.testpolygons1
(
gid serial PRIMARY KEY,
geom geometry(Polygon,3857)
);
CREATE TABLE public.testpolygons2
(
gid serial PRIMARY KEY,
geom geometry(Polygon,3857)
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 October 16, 2015 10:34 — forked from tmcw/xyz_vs_tms.md
The difference between XYZ and TMS tiles and how to convert between them

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 September 28, 2015 07:32
geojson testfile
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Null Island"
},
"geometry": {
"type": "Point",
@neogis-de
neogis-de / postgis_trigger.sql
Last active June 30, 2018 05:02
postgis Trigger between polygon and point layer insert update delete ST_Intersection
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 September 4, 2015 10:14
ogr2ogr merge Ordnance Survey shapefiles from different subfolders together
@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\
#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/
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