Skip to content

Instantly share code, notes, and snippets.

View johnniehard's full-sized avatar
🚀
Making it happen!

Johnnie Hård johnniehard

🚀
Making it happen!
View GitHub Profile
@johnniehard
johnniehard / shpfolder2geojson.sh
Created September 1, 2017 05:14
Converts all shapefiles in input directory to EPSG:4326 GeoJSON files inside of target directory
#!/bin/bash
# Johnnie Hård
# https://synvinkel.org
geojson=".geojson"
# These are set by calling the script with arguments e.g:
# ./shpfolder2geojson.sh MyShapefileDirectory MyGeojsonDirectory
inputdirectory=$1
@johnniehard
johnniehard / Depth DEM
Last active November 27, 2017 14:19
Caclulating depth DEM in QGIS raster calculator.
(( "DEM" - zerolevel) * -1 ) * ((( "DEM" - zerolevel) * -1) > 0)

Keybase proof

I hereby claim:

  • I am iamlukesky on github.
  • I am iamlukesky (https://keybase.io/iamlukesky) on keybase.
  • I have a public key ASDzxKz0aNaCqsYzm34G3T7cShlOI8nRaDGTvaLyK_3p9Qo

To claim this, I am signing this object:

{
"location": { "lat": 0, "lng": 0 },
"data": [
{ "date": "2018-08-31", "cloudy_pct": 23, "B1": 3645, "B2 (etc...)": 4324, "NDVI": 0.4 },
{ "date": "2018-08-25", "cloudy_pct": 21, "B1": 3445, "B2 (etc...)": 4384, "NDVI": 0.3 },
"etc..."
]
}
@johnniehard
johnniehard / orientation.md
Last active July 28, 2018 20:48
Getting the orientation of the longest straight line distance across a polygon.

Some quick and dirty PostGIS:

Get the longest line for your polygons

create table test.tatortlongestline as
select st_longestline(t.geom, t.geom) as geom, t.tatort
from indata.tatort as t
where lanskod = '01';

import { render, html } from 'lit-html'
class MyElement extends HTMLElement {
constructor(){
super()
this.state = {
loading: true
}
}
@johnniehard
johnniehard / index.html
Last active September 1, 2018 07:32 — forked from d3noob/index.html
Sankey Diagram with v4
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
@johnniehard
johnniehard / MBTiles: Pipe GeoJSON from PostGIS to Tippecanoe.md
Last active April 11, 2020 20:49
MBTiles: Pipe GeoJSON from PostGIS to Tippecanoe

I had a large dataset in postgis and wanted to avoid the hassle of first exporting it to a several GB geojson file before tiling it with Tippecanoe.

ogr2ogr -f GeoJSON /dev/stdout \                                                                            
PG:"host=localhost dbname=postgres user=postgres password=thepassword" \
-sql "select * from a, roi where a.geom && roi.geom" \
| docker run -i -v ${PWD}:/data tippecanoe:latest tippecanoe \
--output=/data/yourtiles.mbtiles
@johnniehard
johnniehard / Dockerfile
Last active November 15, 2019 21:25 — forked from perrygeo/Dockerfile
Minimal debian image with Python 3.6 and geo python tools
FROM python:3.6-slim-stretch
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y \
build-essential \
make \
gcc \
locales \
@johnniehard
johnniehard / tunnel.md
Last active March 22, 2019 13:58
Port forward to internal ip. Mongo on Dokku

The mongo service need to have exposed ports as per the documentation.

Then, on the Dokku server run

dokku mongo:info <name>

take note of the internal ip of the Mongo server, exposed ports and the Mongo URI.

Then run