Skip to content

Instantly share code, notes, and snippets.

@fawcett
fawcett / img_index.vrt
Created May 20, 2014 02:31
GDAL vrt for USGS imagery tiles
<VRTDataset rasterXSize="45000" rasterYSize="65000">
<SRS>PROJCS["NAD83 / UTM zone 15N",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.2572221010002,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4269"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-93],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","26915"]]</SRS>
<GeoTransform> 4.7250000000000000e+05, 3.0000000000001142e-01, 0.0000000000000000e+00, 4.9890000000000000e+06, 0.0000000000000000e+00, -3.0000000000018590e-01</GeoTransform>
<VRTRasterBand dataType="Byte" band="1">
<ColorInterp>Red</ColorInterp>
<SimpleSource>
<SourceFilename relativeToVRT="0">/Users/david/projects/mpls_watersheds/data/15TVK725710_201203_0x3000m_CL_1/15TVK725710_201203_0x3000m_CL_1.jp2</So
@fawcett
fawcett / gdalinfo-img_index.txt
Created May 20, 2014 02:36
gdalinfo output for img_index.vrt
gdalinfo img_index.vrt
Driver: VRT/Virtual Raster
Files: img_index.vrt
/Users/david/projects/mpls_watersheds/data/15TVK725710_201203_0x3000m_CL_1/15TVK725710_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725725_201203_0x3000m_CL_1/15TVK725725_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725740_201203_0x3000m_CL_1/15TVK725740_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725755_201203_0x3000m_CL_1/15TVK725755_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725770_201203_0x3000m_CL_1/15TVK725770_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725785_201203_0x3000m_CL_1/15TVK725785_201203_0x3000m_CL_1.jp2
/Users/david/projects/mpls_watersheds/data/15TVK725800_201203_0x3000m_CL_1/15TVK725800_201203_0x3000m_CL_1.jp2
@fawcett
fawcett / mpls-image-creation
Last active August 29, 2015 14:01
Merging DOQ Tiles for large image
Notes on creating a large image from USGS DOQ tiles.
The image tiles are JPEG2000 compressed 5000 x 5000 px images. (~120 of them)
A vrt was create using GDAL build vrt:
gdalbuildvrt -input_file_list filelist.txt img_index.vrt
The output image was created using gdal_translate
gdal_translate img_index.vrt mpls7575.jp2 -outsize 75% 75% -of JP2OpenJPEG -co QUALITY=75 --config GDAL_MAX_DATASET_POOL_SIZE 10
# You can see the results of the requests at requestb.in
# The older request fails and the newer request works (when sent to geocoder)
# http://requestb.in/x90623x9?inspect
#This data payload does not work
addrPayload = {"records": [{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes": {"STREET": "360 Sherman St Ste 300", "ZIP": "55102", "OBJECTID": 468}},{"attributes"
@fawcett
fawcett / gist:2bb87013db5c0d986ac5
Created February 19, 2015 19:51
Maptime MSP - February 2015 Favorite Data Sources
Maptime MSP - February 2015 Favorite Data Sources
Hennepin County [Agata]
http://www.hennepin.us/your-government/open-government/gis-open-data
Minnesota Population Center - TerraPop [Agata]
http://www.terrapop.org/
National Highway Planning Network [Nat]
http://www.rita.dot.gov/bts/sites/rita.dot.gov.bts/files/publications/national_transportation_atlas_database/index.html
@fawcett
fawcett / README.md
Last active August 29, 2015 14:16
Transparent Legend - Mapbox.js

An example showing how to make a transparent custom legend with mapbox.js. Code is based on an example by Tristen.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fawcett
fawcett / gnis_populated_places.sql
Created October 21, 2015 16:15
DDL to create a table in Postgres that can be used to accept the data from a csv file downloaded from GNIS.
-- DROP TABLE test.gnis_pop_places;
CREATE TABLE test.gnis_pop_places
(
feature_id character varying(10),
feature_name character varying(120),
feature_class character varying(50),
state_alpha character varying(2),
state_numeric numeric(2,0),
@fawcett
fawcett / gnis_processing.txt
Created October 21, 2015 17:39
gnis processing and pg copy
$ file POP_PLACES_20151001.txt
POP_PLACES_20151001.txt: UTF-8 Unicode (with BOM) text, with CRLF line terminators
######################
dos2unix POP_PLACES_20151001.txt
cat <<EOT> POP_PLACES_20151001.sql
SET client_encoding = 'UTF8';