Skip to content

Instantly share code, notes, and snippets.

@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.

@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
# 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 / 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
@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 / 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 / ckanApiPurgeOrgExample.py
Last active December 30, 2015 03:49
A quick example on how to purge a group from a CKAN instance via the CKAN API. You will need to edit the code to set the values for your CKAN URI, API key, and the name of the group that you wish to purge. Note that this example requires the ckanap Python module: https://github.com/open-data/ckanapi
import ckanapi
ckanUrl = 'http://uri.to.your.ckan.instance'
apiKey='apiKeyForCkanSysadmin'
groupName='nameOfGroupToBePurged'
def purgeCkanGroup(ckanUrl,apiKey,groupId):
"""
This function purges an organization from a CKAN instance via the CKAN API.
@fawcett
fawcett / Pondering Portals
Last active December 16, 2015 15:09
A collection of the revisit of the geo portal
Brian Timoney
http://mapbrief.com/2013/02/05/why-map-portals-dont-work-part-i/
http://mapbrief.com/2013/02/07/paralysis-of-choice-why-map-portals-dont-work-part-ii/
http://mapbrief.com/2013/02/11/the-tyranny-of-requirements-why-map-portals-dont-work-part-iii/
http://mapbrief.com/2013/02/19/an-iconography-of-confusion-why-map-portals-dont-work-part-iv/
http://mapbrief.com/2013/02/21/the-waiting-is-the-hardest-part-why-map-portals-dont-work-part-v/
http://mapbrief.com/2012/08/01/how-the-public-actually-uses-local-government-web-maps-metrics-from-denver/
http://mapbrief.com/2013/03/15/your-online-map-is-missing-half-its-audience-more-revealing-web-analytics-from-the-field/