Skip to content

Instantly share code, notes, and snippets.

'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
CREATE OR REPLACE FUNCTION gis.split_polygon(poly geometry, expand double precision DEFAULT 0.0001, srid integer DEFAULT 3857, level integer DEFAULT 0)
RETURNS SETOF geometry AS
$BODY$
declare
num_points integer;
env geometry;
p1 geometry;
p2 geometry;
b1 geometry;
b2 geometry;
@@ -14,10 +14,12 @@
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.android.canvas;
+import static android.graphics.Bitmap.Config.ARGB_8888;
+
import java.io.InputStream;
@hjanetzek
hjanetzek / README.md
Last active August 29, 2015 14:09 — forked from markusfisch/README.md

mkatlas

[BASH][1] script to build a [texture atlas][2] for small/medium web sites/games. Requires [ImageMagick][3].

Usage

Basic

/*
clang++-3.6 -DVARIADIC_WRAPPER -O3 -Wall -Wpedantic -std=c++11 variadic.cpp
./a.out
objdump -j .rodata -j .text -d -S a.out > a.txt
clang++-3.6 -O3 -Wall -Wpedantic -std=c++11 variadic.cpp
./a.out
objdump -j .rodata -j .text -d -S a.out > b.txt
/*
clang++-3.6 -DVARIADIC_WRAPPER -O3 -Wall -Wpedantic -std=c++11 variadic.cpp
./a.out
objdump -j .rodata -j .text -d -S a.out > a.txt
clang++-3.6 -O3 -Wall -Wpedantic -std=c++11 variadic.cpp
./a.out
objdump -j .rodata -j .text -d -S a.out > b.txt
cameras:
perspective:
type: perspective
vanishing_point: [0, -500]
lights:
directional1:
type: directional
direction: [.5, .1, -1]
diffuse: .4
ambient: 0.6
@hjanetzek
hjanetzek / gist:5521755
Created May 5, 2013 18:49
Overpass API interpreter-to-pbf output
#!/usr/bin/env bash
# Copyright 2008, 2009, 2010, 2011, 2012 Roland Olbricht
#
# This file is (not yet) part of Overpass_API
#
# Overpass_API is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
CREATE OR REPLACE FUNCTION map.tile_building_test(IN bbox geometry, IN pixel double precision)
RETURNS TABLE(osm_id bigint, tags hstore, geom geometry)
language sql AS
$BODY$
WITH
buildings AS
(SELECT (ROW_NUMBER() OVER(ORDER BY way DESC))::integer AS id, osm_id, way, tags, way_area
FROM osm_polygon
WHERE way && $1
AND (building is not null and not building in ('roof'))),