Skip to content

Instantly share code, notes, and snippets.

View IReese's full-sized avatar

Ian Reese IReese

  • Land Information New Zealand (LINZ)
  • Wellington, New Zealand
View GitHub Profile
seeds:
nz_colour_basemap_webmer_chatham:
caches: [nz_colour_basemap_cache_web_mercator]
grids: [GLOBAL_WEBMERCATOR]
coverages: [nz_chatham]
levels:
to: 18
nz_colour_basemap_webmer_mainland:
caches: [nz_colour_basemap_cache_web_mercator]
grids: [GLOBAL_WEBMERCATOR]
@IReese
IReese / seeds.yml
Last active December 4, 2016 21:33
Te Aro seed
seeds:
nz_colour_basemap_webmer_14:
caches: [nz_colour_basemap_cache_web_mercator]
grids: [GLOBAL_WEBMERCATOR]
coverages: [nz_tearo]
levels:
from: 17
to: 18
coverages:
nz_tearo:
@IReese
IReese / tearo.wkt
Created December 4, 2016 21:32
Te Aro Coverage
Polygon ((174.77125777000796347 -41.28547218863692336, 174.81015305524709902 -41.28557115882837536, 174.80995511486418081 -41.31872617296349404, 174.77155468058231236 -41.31862720277204915, 174.77125777000796347 -41.28547218863692336))
https://github.com/linz/tile-services/issues/42
https://github.com/linz/tile-services/issues/41
Assuming PNG, 8bit color, and nz mainland coverage only
NZTM Zoom 15 (1:500 scale): 612850336 tiles
NZTM zoom 16 (1:250 scale): 2451401344 tiles
Webmer Zoom 19 (1:1000 scale): 228236192 tiles
@IReese
IReese / process_auckland_data.sh
Last active August 15, 2018 00:19
Formatting Auckland DEM/DSM Elevations
#!bin/bash
# The purpose of this script is to process the Auckland 1m DEM and DSM elevation
# data into more manageable pieces for easier viewing in QGIS. The original
# elevation tile downloads from LDS contain 6423 individual tiles. The
# downloaded elevation tiles are reworked into tiffs the same size as the NZ
# LINZ Topo50 Map Sheets
#(https://data.linz.govt.nz/layer/50295-nz-linz-map-sheets-topo-150k/). In
# this case, the original data contains an identifier, like 'AZ31', within
# the tile name that associates it with Topo50 Map Sheets. This script
MAPNIK
git clone https://github.com/mapnik/mapnik --depth 10
cd mapnik
git fetch --all --tags --prune
git checkout tags/v3.0.12 -b v3.0.12
git submodule update --init deps/mapbox/variant
./configure
JOBS=4 make
import csv
import psycopg2
from bs4 import BeautifulSoup
from itertools import zip_longest
#list ids of sql infile
def get_ids():
connection = psycopg2.connect(user="postgres", password="postgres", host="localhost", port="5432", database="geonetwork")
cursor = connection.cursor()
#id_select_query = "SELECT id FROM public.metadata where id = 36344"
@IReese
IReese / gist:9c50578d48017c1389815adfe37db5fc
Created October 8, 2019 21:00
Mapnik XML for Bathy Blending
<Map srs="+proj=merc +lon_0=100 +lat_ts=-41 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs" background-color="#2a383e">
<Style name="niwa_twofifty_hs" comp-op="color-dodge">
<Rule>
<RasterSymbolizer scaling="bilinear" default-mode="linear" default-color="rgba(0, 0, 0, 0)">
<stop value="0" color="#222222"/>
<stop value="255" color="#ebebeb"/></RasterSymbolizer>
</Rule>
</Style>
@IReese
IReese / gist:5b06b79e9abda43739f60bbceb3e2ecf
Created October 8, 2019 21:04
BASH for Creating Geotiff from Bathy PNG
#!/bin/bash
input_extent=
input_png=
output_loc=
function gdal_extent_gdalwarp_te() {
if [ -z "$1" ]; then
echo "Missing arguments. Syntax:"
echo " gdal_extent <input_raster>"
#!/bin/bash
FILE_IN=
file_name=$( basename $FILE_IN | sed 's/.tif//' )
output_dir=
div
function gdal_extent_gdalwarp_te() {