##################################################
# name: extr_by_extent.sh
# Author: Kay Cichini
# Date: 30-04-2013
# Purpose: Extract shp-file features in {infolder} by input extent
# and save new shp-files to {outfolder} that is created on the fly
# Extent Tirol in EPSG:3035 - ETRS89 / ETRS-LAEA
# from D:\GIS_DataBase\GIS_Tirol\Tirol_Extent_LEAE-ETRS.shp
# xMin,yMin 4328054.73,2617730.23 : xMax,yMax 4547691.32,2739524.35
infolder=D:/GIS_DataBase/CorineLC/shps
outfolder=D:/GIS_DataBase/CorineLC/shps_extracted
ext='4328054.73 2617730.23 4547691.32 2739524.35'
ogr2ogr -overwrite $outfolder -spat $ext $infolder
##################################################
##################################################
# name: app_shps.sh
# Author: Kay Cichini
# Date: 30-04-2013
# Purpose: Append shp-files to newly created file
# working directory with shp-files to be appended into one file
mydir=D:/GIS_DataBase/CorineLC/shps_extracted
cd $mydir
# directory where final shp-file will be saved
mydir_final=D:/GIS_DataBase/CorineLC/shps_app_and_extr
mkdir $mydir_final
# get dbfs, which are the actual files to which append the data to
declare -a dbfs=(*.dbf)
# loop through dbfs in dir and append each to the dbf of
# 'extr_and_app.shp' that will be created by ogr2ogr on the fly
# and saved to {mydir_final}
for dbf in ${dbfs[@]}; do
echo appending $dbf to $mydir_final/extr_and_app.dbf
ogr2ogr -append $mydir_final/extr_and_app.dbf $dbf
done
##################################################
2 May 2013
Processing CORINE Land Cover 2006 Seamless Vector Data with OGR/GDAL's ogr2ogr and BASH
Lately I posted about using R to programmatically download all (43 zip-files) seamless 2006 vector data of CORINE Land Cover (see here). In this follow-up I share two bash-scripts with OGR/GDAL's ogr2ogr which I used to extract features by extent (Austria/Tyrol) and to combine all seperate shp-files into one by appending the dbfs. The style I used for the map is also available with german labels HERE.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment