[GRASS-SVN] r31954 - grass/trunk/scripts/v.in.geonames

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 2 04:09:45 EDT 2008


Author: neteler
Date: 2008-07-02 04:09:45 -0400 (Wed, 02 Jul 2008)
New Revision: 31954

Modified:
   grass/trunk/scripts/v.in.geonames/v.in.geonames
Log:
DBF driver warning added

Modified: grass/trunk/scripts/v.in.geonames/v.in.geonames
===================================================================
--- grass/trunk/scripts/v.in.geonames/v.in.geonames	2008-07-02 08:05:21 UTC (rev 31953)
+++ grass/trunk/scripts/v.in.geonames/v.in.geonames	2008-07-02 08:09:45 UTC (rev 31954)
@@ -101,21 +101,24 @@
   exit 1
 fi
 
+# input test
 if [ ! -f "$GIS_OPT_INPUT" ] ; then
     g.message -e "File '${FILEORIG}' not found"
     exit 1
 fi
 
+# DBF doesn't support lengthy text fields
+driver=`db.connect -p | grep -i driver | cut -d':' -f2`
+if [ "$driver" = "dbf" ] ; then
+   g.message -w "Since DBF driver is used, the content of the 'alternatenames' column might be cut with respect to the original Geonames.org column content"
+fi
+
+
 #let's go
 #change TAB to semicolon (we cannot use 'tr' due to possibly repeated empty columns)
 TAB=`awk 'BEGIN{printf "\t";}'`
 cat "${FILEORIG}" | sed  "s+$TAB+|+g"  > "${TMPFILE}".csv
 
-## filter away non-standard chars due to v.in.ascii limitation:
-## TODO: better fix this
-#cat "${TMPFILE}" |  tr -dc "[:blank:][:cntrl:][:graph:][:alnum:][:digit:][:punct:]\n" > "${TMPFILE}.csv"
-#rm -f "${TMPFILE}"
-
 NUM_PLACES=`wc -l "${TMPFILE}.csv" | awk '{print $1}'`
 g.message "Converted $NUM_PLACES place names."
 



More information about the grass-commit mailing list