Skip to content

Instantly share code, notes, and snippets.

View almccon's full-sized avatar
🔣

Alan McConchie almccon

🔣
View GitHub Profile
@juniorz
juniorz / install_postgis_osx.sh
Created July 14, 2011 03:49
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@gka
gka / cartogram.py
Created December 5, 2011 12:09
Generator for Dorling cartograms
"""
Generator for packed circle cartograms
"""
import proj, gisutils
class Cartogram:
def loadCSV(self, url, key='id', value='val', lon='lon', lat='lat'):
import csv
doc = csv.reader(open(url))
@tmcw
tmcw / archive_tweets.py
Created July 31, 2012 21:31
Archive Tweets
import requests, os, glob, json
you = 'tmcw'
data = 'tweets'
try: os.mkdir(data)
except Exception: pass
def run(max_id = False):
already = glob.glob("%s/*.json" % data)
@skorasaurus
skorasaurus / Osm_Terms.md
Last active March 20, 2016 19:58
OpenStreetMap cheat sheet for Common terms and lexicon used in OSM. [assuming node, line, and polygon is covered in the presentation itself)

Changeset: A group of changes that you made to OSM data. Once uploaded to OSM, your edits are instantly available to others if they download OSM data. They may take a few minutes or several hours to appear on the map.

Extract: A large chunk of OSM data for a specific area (like a state, country, or geographic area).

Layer: A data source that's displayed on a slippy map (often is thought of as a group of tiles stitched together). (It also has another meaning in OSM, but don't worry about it right now).

Render: to convert from the OSM data into an image. Rendered data is a map.

Stylesheet: it means a text file of rules that define what features (like roads, buildings) are displayed, and how (what color should the road be ? How wide should be? What icon should be used for a restaurant?) on a map.

Overview

In general, it seems there are roughly five (5) ways to get "file data" (e.g. a GeoTIFF) out of a PostGIS geoprocessing workflow:

  • Export just the raster field as an ASCII grid
  • Connect to the database using a desktop client (e.g. QGIS) [1]
  • Use a procedural language (like PLPGSQL or PLPYthon) [2]
  • Use the COPY declaration to get a hex dump out and convert it to a binary file
  • Fill a 2D NumPy array with a byte array and serialize it to a binary file using GDAL or psycopg2 [3, 4]
  • Use ST_AsTiff() or the more general ST_AsGDALRaster() to get a byte array, which can be written to a binary file

This is my default career advice for people starting out in geo/GIS, especially remote sensing, adapted from a response to a letter in 2013.

I'm currently about to start a Geography degree at the University of [Redacted] at [Redacted] with a focus in GIS, and I've been finding that I have an interest in working with imagery. Obviously I should take Remote Sensing and other similar classes, but I'm the type of person who likes to self learn as well. So my question is this: What recommendations would you give to a student who is interested in working with imagery? Are there any self study paths that you could recommend?

I learned on my own and on the job, and there are a lot of important topics in GIS that I don’t know anything about, so I can’t give comprehensive advice. I haven’t arrived anywhere; I’m just ten minutes ahead in the convoy we’re both in. Take these recommendations critically.

Find interesting people. You’ll learn a lot more from a great professor (or mentor, or friend, or conference) o

@YKCzoli
YKCzoli / Lidar_walkthrough.md
Last active November 15, 2023 18:35
Lidar_walkthrough

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele

@meetar
meetar / HOTQuickstart.md
Last active July 30, 2020 12:15
How to get started contributing to a Humanitarian OpenStreetMap task

##How to get started contributing to a Humanitarian OpenStreetMap Team task

###Overview

OpenStreetMap (OSM) is an open-source map of the world that anyone can edit. But like any map, it's incomplete.

The Humanitarian OpenStreetMap Team (HOT) helps organize people to improve the OSM map for crisis areas, mostly so aid workers can find their way around and make decisions about undermapped places. The data in these crisis areas is often very poor, or completely non-existent. Therefore any contribution you make at all will be a vast improvement, and could materially help people who are on the ground right now, looking at this data as you edit it, and deciding where to go and who to help.

There are many HOT tasks active at once. As of August 2014, the highest-priority tasks are Gaza and areas affected by the West African Ebola outbreak.

@mojodna
mojodna / README.md
Last active September 7, 2016 14:44
TileMill in bash + AppleScript

TileMill in bash + AppleScript

Installation (OS X)

In the project directory:

npm install tessera tilelive-mapnik tilelive-carto
brew install fswatch