From 316407935a1aa193fd60187d913563e30b42b44b Mon Sep 17 00:00:00 2001 From: Martin Spott Date: Mon, 23 Jan 2012 13:21:46 -0800 Subject: [PATCH] Add a sample on how to retrieve VMap0 feature names, done this long ago, just documenting for response on GDAL list. --- gisscripts/grassVMap01convert.sh | 39 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/gisscripts/grassVMap01convert.sh b/gisscripts/grassVMap01convert.sh index b414d7d8..d60a111a 100755 --- a/gisscripts/grassVMap01convert.sh +++ b/gisscripts/grassVMap01convert.sh @@ -27,17 +27,34 @@ mkdir -p ${DUMPDIR} # export LD_LIBRARY_PATH=/opt/GRASS.32/lib OGR2OGR=/opt/GRASS.32/bin/ogr2ogr +OGRINFO=/opt/GRASS.32/bin/ogrinfo -for VMAP_URL in v0eur_5/vmaplv0/eurnasia v0noa_5/vmaplv0/noamer v0sas_5/vmaplv0/sasaus v0soa_5/vmaplv0/soamafr; do - ZONE=`echo ${VMAP_URL} | cut -f 1 -d \/ | sed -e 's/^v0//g' -e 's/_5\$//g'` - for FEATURE in 'aerofacp@trans(*)_point' 'aquecanl@hydro(*)_line' 'barrierl@bnd(*)_line' 'bndtxt@bnd(*)_text' 'builtupa@pop(*)_area' 'builtupp@pop(*)_point' 'coastl@bnd(*)_line' 'contourl@elev(*)_line' 'cropa@veg(*)_area' 'cutfill@phys(*)_line' 'dangerp@hydro(*)_point' 'depthl@bnd(*)_line' 'dqarea@dq(*)_area' 'dqline@dq(*)_line' 'dqline@trans(*)_line' 'dqline@util(*)_line' 'dqtxt@dq(*)_text' 'elevp@elev(*)_point' 'extracta@ind(*)_area' 'extractp@ind(*)_point' 'fishinda@ind(*)_area' 'grassa@veg(*)_area' 'grounda@phys(*)_area' 'hydrotxt@hydro(*)_text' 'indtxt@ind(*)_text' 'inwatera@hydro(*)_area' 'landicea@phys(*)_area' 'libref@libref(*)_line' 'libreft@libref(*)_text' 'lndfrml@phys(*)_line' 'miscl@hydro(*)_line' 'miscp@hydro(*)_point' 'misindp@ind(*)_point' 'mispopa@pop(*)_area' 'mispopp@pop(*)_point' 'mistranl@trans(*)_line' 'oceansea@bnd(*)_area' 'oasisa@veg(*)_area' 'orcharda@veg(*)_area' 'phystxt@phys(*)_text' 'pipel@util(*)_line' 'polbnda@bnd(*)_area' 'polbndl@bnd(*)_line' 'polbndp@bnd(*)_point' 'poptxt@pop(*)_text' 'railrdl@trans(*)_line' 'roadl@trans(*)_line' 'rryardp@trans(*)_point' 'seaicea@phys(*)_area' 'storagep@ind(*)_point' 'swampa@veg(*)_area' 'tileref@tileref(*)_area' 'tilereft@tileref(*)_text' 'traill@trans(*)_line' 'transtrc@trans(*)_point' 'transtrl@trans(*)_line' 'transtxt@trans(*)_text' 'treesa@veg(*)_area' 'tundraa@veg(*)_area' 'utill@util(*)_line' 'utilp@util(*)_point' 'utiltxt@util(*)_text' 'watrcrsl@hydro(*)_line'; do - CATEGORY=`echo ${FEATURE} | cut -f 1 -d \@` - DIR=`echo ${FEATURE} | cut -f 1 -d \( | cut -f 2 -d \@` - TYPE=`echo ${FEATURE} | cut -f 2 -d \_` - OUTPUT=${ZONE}_${DIR}-${CATEGORY}-${TYPE} - echo "### ${VMAP_URL} # ${FEATURE} # ${OUTPUT} ###" - ${OGR2OGR} -f "ESRI Shapefile" ${DUMPDIR}/${OUTPUT}.shp gltp:/vrf/home/martin/live/vmap0/${VMAP_URL} ${FEATURE}; echo ${?} - done -done +AREAS="v0eur_5/vmaplv0/eurnasia v0noa_5/vmaplv0/noamer v0sas_5/vmaplv0/sasaus v0soa_5/vmaplv0/soamafr" + +# Proposal on how to retrieve available features: +# +GetFeatureNames () { + for VMAP_URL in ${AREAS}; do + ${OGRINFO} gltp:/vrf/home/martin/live/vmap0/${VMAP_URL} + done 2>&1 | egrep \^"[0-9]" | awk '{print $2}' | sort | uniq +} + +# Finally convert: +# +ConvertToSHapefiles () { + for VMAP_URL in ${AREAS}; do + ZONE=`echo ${VMAP_URL} | cut -f 1 -d \/ | sed -e 's/^v0//g' -e 's/_5\$//g'` + for FEATURE in 'aerofacp@trans(*)_point' 'aquecanl@hydro(*)_line' 'barrierl@bnd(*)_line' 'bndtxt@bnd(*)_text' 'builtupa@pop(*)_area' 'builtupp@pop(*)_point' 'coastl@bnd(*)_line' 'contourl@elev(*)_line' 'cropa@veg(*)_area' 'cutfill@phys(*)_line' 'dangerp@hydro(*)_point' 'depthl@bnd(*)_line' 'dqarea@dq(*)_area' 'dqline@dq(*)_line' 'dqline@trans(*)_line' 'dqline@util(*)_line' 'dqtxt@dq(*)_text' 'elevp@elev(*)_point' 'extracta@ind(*)_area' 'extractp@ind(*)_point' 'fishinda@ind(*)_area' 'grassa@veg(*)_area' 'grounda@phys(*)_area' 'hydrotxt@hydro(*)_text' 'indtxt@ind(*)_text' 'inwatera@hydro(*)_area' 'landicea@phys(*)_area' 'libref@libref(*)_line' 'libreft@libref(*)_text' 'lndfrml@phys(*)_line' 'miscl@hydro(*)_line' 'miscp@hydro(*)_point' 'misindp@ind(*)_point' 'mispopa@pop(*)_area' 'mispopp@pop(*)_point' 'mistranl@trans(*)_line' 'oceansea@bnd(*)_area' 'oasisa@veg(*)_area' 'orcharda@veg(*)_area' 'phystxt@phys(*)_text' 'pipel@util(*)_line' 'polbnda@bnd(*)_area' 'polbndl@bnd(*)_line' 'polbndp@bnd(*)_point' 'poptxt@pop(*)_text' 'railrdl@trans(*)_line' 'roadl@trans(*)_line' 'rryardp@trans(*)_point' 'seaicea@phys(*)_area' 'storagep@ind(*)_point' 'swampa@veg(*)_area' 'tileref@tileref(*)_area' 'tilereft@tileref(*)_text' 'traill@trans(*)_line' 'transtrc@trans(*)_point' 'transtrl@trans(*)_line' 'transtxt@trans(*)_text' 'treesa@veg(*)_area' 'tundraa@veg(*)_area' 'utill@util(*)_line' 'utilp@util(*)_point' 'utiltxt@util(*)_text' 'watrcrsl@hydro(*)_line'; do + CATEGORY=`echo ${FEATURE} | cut -f 1 -d \@` + DIR=`echo ${FEATURE} | cut -f 1 -d \( | cut -f 2 -d \@` + TYPE=`echo ${FEATURE} | cut -f 2 -d \_` + OUTPUT=${ZONE}_${DIR}-${CATEGORY}-${TYPE} + echo "### ${VMAP_URL} # ${FEATURE} # ${OUTPUT} ###" + ${OGR2OGR} -f "ESRI Shapefile" ${DUMPDIR}/${OUTPUT}.shp gltp:/vrf/home/martin/live/vmap0/${VMAP_URL} ${FEATURE}; echo ${?} + done + done +} + +GetFeatureNames # EOF