# Requires Node.js and NPM
sudo npm install -g topojson
# Install the geojson-cli
sudo npm install -g geojson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convex_hull_graham(points): | |
''' | |
Returns points on convex hull in CCW order according to Graham's scan algorithm. | |
By Tom Switzer <thomas.switzer@gmail.com>. | |
''' | |
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0) | |
def cmp(a, b): | |
return (a > b) - (a < b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def tweensegs(longitude1, latitude1, longitude2, latitude2, num_of_segments): | |
ptlon1 = longitude1 | |
ptlat1 = latitude1 | |
ptlon2 = longitude2 | |
ptlat2 = latitude2 | |
numberofsegments = num_of_segments | |
onelessthansegments = numberofsegments - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USERNAME=heyyouguys | |
# NOTE: Could not determine which jpeg library should be installed; it's probably installed by default | |
sudo apt-get install libtiff5 libtiff5-dev libgeotiff2 libgeotiff-dev libxml2 libxml2-dev | |
# http://www.hdfgroup.org/release4/obtainsrc.html | |
sudo mkdir /usr/local/hdf4 && sudo chown $USERNAME /usr/local/hdf4 && cd /usr/local/hdf4 | |
wget http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/hdf-4.2.11.tar.gz | |
tar -xzvf hdf-4.2.11.tar.gz | |
cd hdf-4.2.11 |
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from django.core.management.base import BaseCommand, CommandError | |
from django.core.exceptions import ValidationError, ObjectDoesNotExist | |
from django.db.models.fields import FieldDoesNotExist | |
from scour_server.nbi.models import Bridge | |
class Command(BaseCommand): | |
args = '<path>' | |
help = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Reports the min and max July temperatures for each file | |
that matches the given filename pattern. | |
''' | |
import csv | |
import os | |
import sys | |
import glob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clear out any old ppa's that might conflict | |
sudo rm /etc/apt/sources.list.d/*mapnik* | |
sudo rm /etc/apt/sources.list.d/*developmentseed* | |
sudo rm /etc/apt/sources.list.d/*chris-lea* | |
# Add new ppa's | |
echo 'yes' | sudo apt-add-repository ppa:chris-lea/node.js | |
echo 'yes' | sudo apt-add-repository ppa:mapnik/nightly-trunk | |
# Update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A module for machine learning on Landsat data; implemented and tested, | |
specifically, for learning water areas on an image. Performance so far: | |
Gaussian naive Bayes (where validation data chosen by the hydro mask): | |
Mean precision: Not water=0.9997, Water=0.3090 | |
Mean recall: Not water=0.9787, Water=0.9763 | |
Gaussian naive Bayes (where validation data inspected in Google Earth): | |
Mean precision: Not water=0.9675, Water=1.0000 |
NewerOlder