Skip to content

Instantly share code, notes, and snippets.

@hjanetzek
hjanetzek / gist:62794836821182c80dcb
Last active December 10, 2016 02:04
drawing circles
package org.oscim.test;
import static java.lang.Math.random;
import static org.oscim.backend.canvas.Color.fade;
import static org.oscim.utils.ColorUtil.shiftHue;
import org.oscim.backend.canvas.Color;
import org.oscim.core.GeometryBuffer;
import org.oscim.gdx.GdxMapApp;
import org.oscim.layers.GenericLayer;
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;
'''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.
@hjanetzek
hjanetzek / gist:7715486
Last active December 29, 2015 19:10
OpenJDK fail?
package eeek;
public class Test {
abstract class Inlist<T> {
T next;
}
abstract class Pool<T extends Inlist<T>> {
abstract T get();
}
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'))),
@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.