Skip to content

Instantly share code, notes, and snippets.

Alexander Salveson Nossum alexanno

View GitHub Profile
@alexanno
alexanno / gist:789fedb9e4378d4dd0c6
Created Jun 3, 2015
git https:// instead of git://
View gist:789fedb9e4378d4dd0c6
git config --global url."https://".insteadOf git://
@alexanno
alexanno / unzip+load.sos.sh
Last active Aug 29, 2015
Unzip and load multiple SOSI files to one Postgis-table with ogr2ogr
View unzip+load.sos.sh
#unzip all zip files
unzip '*.zip'
find ./ -name \*Stedsnavn*.sos -execdir ogr2ogr --config PG_USE_COPY YES --config PG_USE_BASE64 YES -update -append -f PostgreSQL PG:'host=localhost port=5432 dbname=alexanno user=alexanno active_schema=sandbox' -progress -nlt PROMOTE_TO_MULTI -nln stedsnavn_norge {} \;
@alexanno
alexanno / color_ubuntu.sh
Created May 8, 2015
Color in Ubuntu shell
View color_ubuntu.sh
LS_COLORS=$LS_COLORS:'di=1;32:' ; export LS_COLORS
#http://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console
Blue = 34
Green = 32
Light Green = 1;32
Cyan = 36
Red = 31
Purple = 35
View landsat-util-testing.sh
#ubuntu 14.04 64x
#https://github.com/developmentseed/landsat-util
#https://github.com/landsat-pds/landsat_ingestor/wiki/Accessing-Landsat-on-AWS
#https://developmentseed.org/blog/2015/03/19/aws-landsat-archive/
#https://developmentseed.org/blog/2015/03/28/twice-as-fast/
#http://landsat.usgs.gov/landsat8.php
sudo apt-get update
sudo apt-get install python-pip python-numpy python-scipy libgdal-dev libatlas-base-dev gfortran
sudo pip install landsat-util
@alexanno
alexanno / printing_python_qgis.py
Created Mar 8, 2015
Printing with Python and QGIS
View printing_python_qgis.py
#http://kartoza.com/how-to-create-a-qgis-pdf-report-with-a-few-lines-of-python/
# coding=utf-8
# A simple demonstration of to generate a PDF using a QGIS project
# and a QGIS layout template.
#
# This code is public domain, use if for any purpose you see fit.
# Tim Sutton 2015
View dump_postgis_ogr2ogr.sh
READHOST=***
READUSER=***
READPASSWORD=***
WRITEHOST=***
WRITEPASSWORD=***
WRITEUSER=***
## vars need integration in commands with ex: host=$READHOST
ogr2ogr --config PG_USE_COPY YES -f GeoJSON testsql.geojson PG:'host=localhost dbname=alexanno user=alexanno' -progress -sql "SELECT * FROM sandbox.kommuner" -lco COORDINATE_PRECISION=5
View postgis-lamp-provision.sh
#!/usr/bin/env bash
COLOR="\033[;35m"
COLOR_RST="\033[0m"
sudo apt-get update
sudo apt-get -y install python-software-properties build-essential curl
echo -e "${COLOR}--- Installing PHP5 ---${COLOR_RST}"
sudo apt-get install -y php5 php5-curl php5-pgsql
View aggregate hex_grid.sql
set search_path to "sandbox","public";
DROP VIEW IF EXISTS grid_test_001;
CREATE VIEW grid_test_001 as (
SELECT g.gid, g.the_geom, count(*) FROM hex_grid_001 g
JOIN n1000_turisthytte p
ON g.the_geom && st_transform(p.wkb_geometry,4326)
GROUP BY g.gid, g.the_geom
);
CREATE TABLE sandbox.t_grid_n1000_byggpkt_0125 AS
View loading into postgis.sh
find ./ -name \*Elveg.SOS -execdir echo "ogr2ogr -update -append -f PostgreSQL PG:'host=localhost port=54321 dbname=sandbox user=postgres active_schema=sandbox' -progress -nln elveg {}" \;
find ./ -name \*Adresser.SOS -execdir ogr2ogr -update -append -f PostgreSQL PG:'host=localhost port=54321 dbname=sandbox user=postgres active_schema=sandbox' -progress -nln adresser {} \;
####################################################
#using shp2pgsql
#!/bin/bash
for f in *.shp
do
You can’t perform that action at this time.