This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PGPASSWORD=password | |
PGOPTS="-d database -h host -U user" | |
# water polygons | |
# | |
wget http://data.openstreetmapdata.com/water-polygons-split-3857.zip | |
unzip water-polygons-split-3857.zip | |
shp2pgsql -dID -s 900913 -W Windows-1252 -g the_geom water-polygons-split-3857/water_polygons.shp water_polygons | psql $PGOPTS | |
rm ./water-polygons-split-3857.zip && rm -rf ./water-polygons-split-3857 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct point { | |
int x, y; | |
} point; | |
typedef struct point3d { | |
struct point; | |
int z; | |
} point3d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
-- update functions | |
CREATE OR REPLACE FUNCTION mz_calculate_is_landuse( | |
landuse_val text, leisure_val text, natural_val text, highway_val text, amenity_val text, aeroway_val text) | |
RETURNS BOOLEAN AS $$ | |
BEGIN | |
RETURN | |
landuse_val IN ('park', 'forest', 'residential', 'retail', 'commercial', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
ALTER TABLE planet_osm_polygon DISABLE TRIGGER USER; | |
COMMIT; | |
BEGIN; | |
CREATE OR REPLACE FUNCTION mz_calculate_is_water( | |
waterway_val text, natural_val text, landuse_val text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/qedus/osmpbf" | |
"io" | |
"log" | |
"os" | |
"runtime" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ virtualenv --python=python3 env3 | |
Running virtualenv with interpreter /usr/bin/python3 | |
Using base prefix '/usr' | |
New python executable in env3/bin/python3 | |
Also creating executable in env3/bin/python | |
Installing setuptools, pip...done. | |
$ source env3/bin/activate | |
$ python -V | |
Python 3.4.0 | |
$ python setup.py develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- functions.sql will get run first | |
-- point.sql and polygon.sql will get run in parallel | |
-- cleanup-point.sql will get run after the new code gets deployed | |
-- diffs will be turned off before applying updates, and then re-enabled | |
-- nothing should lock the tables for reading though | |
-------------------------------------------------------------------------------- | |
-- functions.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- (will need to update relevant polygons/lines that have been updated) | |
-- IF YOU UPDATE THIS, PLEASE UPDATE mz_calculate_landuse_kind | |
-- BELOW! | |
CREATE OR REPLACE FUNCTION mz_calculate_is_landuse( | |
landuse_val text, leisure_val text, natural_val text, highway_val text, | |
amenity_val text, aeroway_val text, tourism_val text, man_made_val text, | |
power_val text, boundary_val text) | |
RETURNS BOOLEAN AS $$ | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION mz_one_pixel_zoom( | |
way_area real) | |
RETURNS real AS $$ | |
BEGIN | |
RETURN | |
CASE WHEN way_area < 5.704 | |
THEN 16.0 | |
ELSE (17.256-ln(way_area)/ln(4)) | |
END; | |
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE planet_osm_point DISABLE TRIGGER USER; | |
ALTER TABLE planet_osm_polygon DISABLE TRIGGER USER; | |
CREATE OR REPLACE FUNCTION mz_one_pixel_zoom( | |
way_area real) | |
RETURNS real AS $$ | |
BEGIN | |
RETURN | |
CASE WHEN way_area < 5.704 | |
THEN 16.0 |
OlderNewer