Skip to content

Instantly share code, notes, and snippets.

@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.

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 / 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)
BEGIN;
-------------------------------------------------------
-- CREATE test tables
CREATE TABLE label_point (
gid serial NOT NULL,
geom geometry(point, 3857),
label_sample varchar(255),
@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