Skip to content

Instantly share code, notes, and snippets.

View almccon's full-sized avatar
🔣

Alan McConchie almccon

🔣
View GitHub Profile
@wboykinm
wboykinm / turf_and_vts.md
Last active April 15, 2024 14:57
Learnings while geoprocessing vector tiles with turf.js
@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
@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

@rgdonohue
rgdonohue / README.md
Last active January 11, 2023 21:43
Batch Geocoding Script with GeoPy
@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.

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
@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))
@clhenrick
clhenrick / carto-design-resources.md
Last active March 30, 2017 18:47
Cartographic Design Resources, a by no means exhaustive list and work in progress.

Cartographic Design Resources

by Chris Henrick

Tools

  • Color Brewer: Tool created by Cynthia Brewer that offers advice for using color on maps, specifically with thematic mapping. Lets you export color schemes to various formats.

  • Mapshaper for generalizing your geospatial data which helps your maps not only look better but load faster. Mapshaper let's you preview how generalized it looks before you export it.

Guides & Tutorials

  • Nathaniel Kelso's Geo How To wiki though now a little out dated still has lots of great info in it.
states = fl la nc ok va \
al ga ma nd or vt \
ar hi md ne pa wa \
az ia me nh ri wi \
ca id mi nj sc wv \
co il mn nm sd wy \
ct in mo nv tn \
dc ks ms ny tx \
de ky mt oh ut