Skip to content

Instantly share code, notes, and snippets.

@dalekunce
Last active August 29, 2015 14:10
Show Gist options
  • Save dalekunce/4f0521f7d40def3d4fb0 to your computer and use it in GitHub Desktop.
Save dalekunce/4f0521f7d40def3d4fb0 to your computer and use it in GitHub Desktop.
hottask_to_shapefile.sh
#!/bin/bash
#######################################################
##
## Created by Dale Kunce: (dale.kunce@redcross.org)
## Download a @hotosm task manager task and output to shapefile.
##
## chmod +x hottask_to_shapefile.sh
## ./hottask_to_shapefil.sh <task#>
##
#######################################################
#define are limited variables
task=$1
log=./log.txt
echo "download of $task started $(date -I)" >> $log
##get the json
wget http://tasks.hotosm.org/project/$task/tasks.json
#rename file so it has a proper name
mv task.json $task.json
#convert to shapefile
ogr2ogr -f "ESRI Shapefile" $task.shp $task.json
if [ $? == 0 ]; then
echo "SUCCESS converting $task $(date +%Y_%m_%d)" >> $log
else
echo "FAILED converting $task $(date +%Y_%m_%d)" >> $log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment