Created
August 20, 2014 10:03
-
-
Save capooti/f1f272eeefc1ceb89007 to your computer and use it in GitHub Desktop.
Rename shapefile field names from uppercase to lowercase using OGR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -a fields=("ROADID" "SOURCEID" "NOTES" "ONME" "RTENME" "NTLCLASS" "FCLASS" "NUMLANES" "SRFTPE" "SRFCOND" "SRFPREP" "ISSEASONAL" "CURNTPRAC" "GNRALSPEED" "GDWTHRPRAC" "BDWTHRPRAC" "SHAPE_LENG" "ADM0_CODE" "ADM0_NAME" "CONTINENT" "REGION") | |
shp="was_trs_roads_wfp" | |
for f in "${fields[@]}" | |
do | |
lf=$(echo $f | awk '{print tolower($0)}') | |
echo $lf | |
ogrinfo $shp.shp -sql "ALTER TABLE $shp RENAME COLUMN $f TO $lf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment