Skip to content

Instantly share code, notes, and snippets.

Avatar
🧭
Focusing

Erick Otenyo erick-otenyo

🧭
Focusing
View GitHub Profile
@erick-otenyo
erick-otenyo / raster-pixels-to-polygons.go
Last active Mar 30, 2022
Convert a raster layer to a vector layer, by creating geojson polygon features for each individual pixel's extent in the raster layer. Equivalent to QGIS' Raster pixels to polygons Algorithm
View raster-pixels-to-polygons.go
package main
import (
"errors"
"flag"
"math"
"os"
"github.com/lukeroth/gdal"
geojson "github.com/paulmach/go.geojson"
@erick-otenyo
erick-otenyo / .docker-private-registry-with-read-write-control.md
Created Apr 18, 2021
Run docker private registry with read/write access control
View .docker-private-registry-with-read-write-control.md
@erick-otenyo
erick-otenyo / django_import_shp_zip_to_postgres.py
Last active Jan 31, 2021
Import a zipped shapefile to a new postgis table
View django_import_shp_zip_to_postgres.py
import pygeoif
import shapefile
from django.db import connection, transaction
from zipfile import ZipFile
from io import BytesIO
def shp_files_sorter(file_name):
"""
:param file_name:
@erick-otenyo
erick-otenyo / parse_dotenv.bash
Created Jan 28, 2021 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
View cyclone_sample_track.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erick-otenyo
erick-otenyo / README.md
Created Dec 7, 2020 — forked from mau21mau/README.md
Configure Celery + Supervisor With Django
View README.md
@erick-otenyo
erick-otenyo / rsync_backup.py
Created Nov 4, 2020 — forked from seebk/rsync_backup.py
Python rsync backup script
View rsync_backup.py
#!/usr/bin/python3
#######################################################
# Python rsync Backup script
# Sebastian Kraft, 24.06.2013
#
#######################################################
#-----------------------------------------------------
# Config
View baringo_health_facilities_sample.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erick-otenyo
erick-otenyo / geonode_to_terriajs.js
Last active Oct 2, 2019
Fetch geonode layers from api and format for Terra JS
View geonode_to_terriajs.js
const geonode2Terriajs = async (geonodeUrl,geonodeGeoserverUrl,proxyUrl)=> {
const catalog = []
try{
// fetch layers from geonode api, using proxy if provided
const layers = await fetch(proxyUrl?`${proxyUrl}/${geonodeUrl}`:geonodeUrl).then(res=>res.json()).then(layers=>layers.objects)
// group the layers by category
const layersByCategory = layers.reduce((all,layer)=>{
@erick-otenyo
erick-otenyo / pip-install-gdal.md
Created Jun 19, 2019 — forked from cspanring/pip-install-gdal.md
Installing GDAL in a Python virtual environment
View pip-install-gdal.md

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment: