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
const csvWriter = require('csv-write-stream')
const shapefile = require("shapefile");
const cover = require('@mapbox/tile-cover');
const fs = require('fs');
async function main() {
const shp = await shapefile.read('~/nz-imagery-surveys_wgs.shp');
//console.log(shp)
var shapefile = require("shapefile");
const cover = require('@mapbox/tile-cover');
const fs = require('fs');
async function main() {
const shp = await shapefile.read("~lds-nz-imagery-surveys-SHP/nz-imagery-surveys_wgs.shp")
console.log(shp)
var limits = {
{
"type": "Polygon",
"coordinates": [
[
[
177.4832659,
-37.617147
],
[
177.5549797,
{
"type": "Polygon",
"coordinates": [
[
[-180.0000, 90.0000],
[-180.0000, -90.0000],
[180.0000, -90.0000],
[180.0000, 90.0000],
[-180.0000, 90.0000]
]
#!/bin/bash
A_json=./world_all_test.json
B_json=./gizzy_full_extent_test.json
#extract coord for world poly
Aulx=$( jq .coordinates[0][0][0] $A_json )
Auly=$( jq .coordinates[0][0][1] $A_json )
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map background-color="#2a383e" srs="PROJECTION_STRING">
<Style comp-op="color-dodge" filter-mode="first" name="gebco2019webmercator2">
<Rule>
<RasterSymbolizer default-color="rgba(0, 0, 0, 0)" default-mode="linear" scaling="bilinear">
<stop color="#222222" value="0" />
<stop color="#ebebeb" value="255" />
</RasterSymbolizer>
#!/bin/bash
#Run script from within package directory. Be sure XML file is stored in this directory.
#Download data here
#wget https://www.bodc.ac.uk/data/open_download/gebco/GEBCO_15SEC/zip/
#unzip GEBCO_2019.zip
#gdal_translate -of GTiff GEBCO_2019/GEBCO_2019.nc GEBCO_2019.tif
#gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 GEBCO_2019.tif GEBCO_2019_webmer.tif
#!/bin/bash
FILE_IN=$1
function gdal_get_proj() {
PROJ4=$(gdalinfo -nomd $1 |\
grep "EXTENSION" |\
sed 's/EXTENSION//g' |\
sed 's/PROJ4//g' |\
#!/bin/bash
FILE_IN=$1
file_name=$( basename $FILE_IN | sed 's/.tif//' )
function gdal_extent_gdalwarp_te() {
if [ -z "$1" ]; then
echo "Missing arguments. Syntax:"
echo " gdal_extent <input_raster>"
#!/bin/bash
FILE_IN=$1
TILE_NUM=$2
file_name=$( basename $FILE_IN | sed 's/.tif//' )
function tiff_dims() {
EXTENT=$(tiffinfo "$1" | grep 'Image Width:' | sed 's/Image Width://' | sed 's/Image Length://' )