Skip to content

Instantly share code, notes, and snippets.

View colemanm's full-sized avatar

Coleman McCormick colemanm

View GitHub Profile
@colemanm
colemanm / convert_bsb.sh
Last active December 18, 2023 05:04
Converting NOAA raster charts to GeoTIFF for TileMill
# First convert BSB to GeoTIFF format using the KAP file
gdal_translate -of GTiff 11392_1.KAP 11392_1.tif
# Reproject to WGS84 (geodetic) to use in TileMill
gdalwarp -t_srs EPSG:4326 11392_1.tif 11392_1_wgs.tif
# Then simply add your new `11392_1_wgs.tif` file to TileMill as a new raster layer.
@colemanm
colemanm / qgis_open_photo_action.md
Last active February 3, 2020 20:45
Custom action to link to photos within a GIS feature class.

QGIS Open Image Custom Action

Use this guide to link a path name to a feature's photo in the attribute table.

This assumes you have a column in your data containing the full path to the image you'd like to open (in this example, a field called photo_path).

Create Action

  1. Right click feature class → Properties
  2. On Actions tab:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@colemanm
colemanm / google-sheets-geocode.js
Last active May 24, 2018 13:36
Google Sheets geocoder
function geocodeSelectedCells() {
var sheet = SpreadsheetApp.getActiveSheet();
var cells = sheet.getActiveRange();
// Must have selected 3 columns (Location, Lat, Lng).
// Must have selected at least 1 row.
if (cells.getNumColumns() != 3) {
Logger.log("Must select the Location, Lat, Lng columns.");
return;
@colemanm
colemanm / dunedin_sail.geojson
Last active December 25, 2015 12:59
Sailing in Dunedin
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@colemanm
colemanm / gdal_configure.sh
Created September 28, 2013 16:06
GDAL configure
./configure \
--with-local=yes \
--prefix=/Users/coleman/local \
--with-threads \
--with-libtool \
--with-libtiff=internal \
--with-geotiff=internal \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-bsb \
@colemanm
colemanm / map.geojson
Created September 4, 2013 20:11
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@colemanm
colemanm / x.rb
Created August 29, 2013 21:20
Unrar password protected archives from a txt list of archive files.
#!/usr/bin/env ruby
# Requires the rar utility
# apt-get install rar
# List of filenames to be extracted
l = File.read(ARGV[0])
# Password
p = ARGV[1]
@colemanm
colemanm / sample.vrt
Created August 28, 2013 16:27
VRT file for ogr2ogr
<OGRVRTDataSource>
<OGRVRTLayer name="test">
<SrcDataSource>test.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/>
</OGRVRTLayer>
</OGRVRTDataSource>
@colemanm
colemanm / map.geojson
Created August 21, 2013 16:06
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.