Skip to content

Instantly share code, notes, and snippets.

--shp2pgsql -s 4326 -d -I 'SSC_2011_AUST.shp' 'SSC' | psql -d gis -h localhost -U simonhope
--shp2pgsql -s 4326 -d -I 'POA_2011_AUST.shp' 'POA' | psql -d gis -h localhost -U simonhope
--update the data types
ALTER TABLE SSC ALTER COLUMN SSC_CODE TYPE NUMERIC USING SSC_CODE::INTEGER;
ALTER TABLE POA ALTER COLUMN POA_CODE TYPE NUMERIC USING POA_CODE::INTEGER;
--explode multipolygons to single parts
CREATE TABLE POA_EXPLODE AS
SELECT
@mapbutcher
mapbutcher / sample_aws_s3_bucket_policy
Created January 7, 2014 00:36
Sample AWS s3 policy file which restricts access to a bucket to a specific IP
{
"Id": "Policy1389052986005",
"Statement": [
{
"Sid": "Stmt1389052982765",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::muppets-mapping-data/SA1_2011_AUST_CENTROID.csv",
@mapbutcher
mapbutcher / Postgresql-module-install
Created October 23, 2013 01:48
Notes on how to install a missing module from PostgreSQL
#Notes on how to install a missing module from PostgreSQL
#Download and Postgresql (no need to make install because we already have it..):
#pre-requisites
sudo apt-get install gcc
sudo apt-get install libreadline-dev
sudo apt-get install zlib1g-dev
wget http://ftp.postgresql.org/pub/source/v9.3.0/postgresql-9.3.0.tar.gz
/// <summary>
/// Calls the Arc GIS server.
/// </summary>
/// <param name="URI">The URI.</param>
/// <param name="response">The response.</param>
static public void CallArcGISServer(string URI, out JObject response)
{
Stream data = null;
StreamReader reader = null;
@mapbutcher
mapbutcher / EnableWinRm
Created July 17, 2013 01:19
Enable WinRM with basic auth
set-executionpolicy -executionpolicy remotesigned
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
@mapbutcher
mapbutcher / gist:5623849
Last active December 17, 2015 14:19
Python class which uses mapnik to create a static map based upon a coordinate.
import mapnik
from shapely.geometry import *
class StaticMap:
srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
wgs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
stylesheet = 'REA_Bright_Local.xml'
markername = 'rea.png'
exportpath = 'output/'