Skip to content

Instantly share code, notes, and snippets.

@jwalgran
Created April 16, 2015 06:14
Show Gist options
  • Save jwalgran/43911ab9e6993bf8b233 to your computer and use it in GitHub Desktop.
Save jwalgran/43911ab9e6993bf8b233 to your computer and use it in GitHub Desktop.
An Ansible playbook that downloads the 2011 National Land Cover Database and converts it to Azavea Raster Grid format
# Requires about 40GB of available disk space under /var
---
- name: Install tools
apt: pkg={{ item }} state=present
with_items:
- "zip"
- "unzip"
- name: Install Geospatial libraries
apt: pkg={{ item }} state=present
with_items:
- "binutils=2.24*"
- "libproj-dev=4.8.0*"
- "gdal-bin=1.10.1*"
- "libgdal1-dev=1.10.1*"
- name: Create data directory
file: path=/var/data state=directory
- name: Download NLCD 2011
get_url: url=http://tdds.cr.usgs.gov/landcover/NLCD2011/nlcd_2011_landcover_2011_edition_2014_10_10.zip
dest=/var/data/nlcd_2011.zip
mode=444
- name: Unzip NLCD 2011
unarchive: src=/var/data/nlcd_2011.zip
dest=/var/data
creates=/var/data/nlcd_2011_landcover_2011_edition_2014_10_10/nlcd_2011_landcover_2011_edition_2014_10_10.ige
copy=no
- name: Convert NLCD 2011 to ARG
command: gdal_translate -of ARG nlcd_2011_landcover_2011_edition_2014_10_10.img nlcd_2011.arg
chdir=/var/data/nlcd_2011_landcover_2011_edition_2014_10_10
creates=/var/data/nlcd_2011_landcover_2011_edition_2014_10_10/nlcd_2011.arg
- name: Zip NLCD 2011 ARG
command: zip nlcd_2011.zip nlcd_2011.arg nlcd_2011.json
chdir=/var/data/nlcd_2011_landcover_2011_edition_2014_10_10
creates=/var/data/nlcd_2011_landcover_2011_edition_2014_10_10/nlcd_2011.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment