From fd538c838dbe37b75d9a63e5b1951c972df6e9ca Mon Sep 17 00:00:00 2001
From: User Erdgeist <erdgeist@avon.ccc.de>
Date: Mon, 3 Feb 2014 05:56:30 +0000
Subject: Extract coordinates and try to map them

---
 src/makecolumns.sh | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

(limited to 'src')

diff --git a/src/makecolumns.sh b/src/makecolumns.sh
index 4666f3f..1d19ada 100644
--- a/src/makecolumns.sh
+++ b/src/makecolumns.sh
@@ -167,16 +167,6 @@ handle_new_format() {
     cat file_* > streets
     rm file_*
 
-    if [ -f $1/zip-streets-hn-geo.tl ]; then
-      ../bin/decompress $1/zip-streets-hn-geo.tl
-      cat file_* | tr '\n\0' '\t\n' > 90_Geokoordinaten_hnr
-      rm file_*
-    elif [ -f $1/zip-streets-geo.tl ]; then
-      ../bin/decompress $1/zip-streets-geo.tl
-      cat file_* | tr '\n\0' '\t\n' > 91_Geokoordinaten_str
-      rm file_*
-    fi
-
     ../bin/decompress $1/phonebook.db
 
     numfiles=`find . -name file_\* | wc -l`
@@ -191,6 +181,7 @@ handle_new_format() {
         fi
      done;
     done
+    find . -name file_\* -delete
 
     mv column_0 01_Flags
     mv column_1 02_Nachname
@@ -211,8 +202,18 @@ handle_new_format() {
     else
       echo Could not convert streetindexes
     fi
+    sed -E $'s:$:\t:' < 07_08_Strassenindex_Hausnummer | cut -f 2 > 08_Hausnummer
 
-    find . -name file_\* -delete
+    if [ -f $1/zip-streets-hn-geo.tl ]; then
+      ../bin/decompress $1/zip-streets-hn-geo.tl
+      cat file_* > 90_Geokoordinaten_hnr
+      lam 10_Postleitzahl -s $'\t' 07_Strasse -s $'\t' 08_Hausnummer | ../bin/mapcoords 90_Geokoordinaten_hnr > 16_Koordinaten
+    elif [ -f $1/zip-streets-geo.tl ]; then
+      ../bin/decompress $1/zip-streets-geo.tl
+      cat file_*  > 91_Geokoordinaten_str
+      lam 10_Postleitzahl -s $'\t' 07_Strasse | ../bin/mapcoords 91_Geokoordinaten_str > 16_Koordinaten
+    fi
+    rm file_*
 }
 
 # After function definitions, main() can use them
-- 
cgit v1.2.3