From a6e23b72ab88b22f7fccfa44136b6f08706514d3 Mon Sep 17 00:00:00 2001 From: vv01f Date: Fri, 31 Jan 2020 01:29:08 +0100 Subject: [PATCH] fix hauseno --- lookup.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lookup.py b/lookup.py index 4f078be..9a7fc07 100755 --- a/lookup.py +++ b/lookup.py @@ -37,23 +37,21 @@ firstline = True # start json list print ( '{"type":"FeatureCollection","features":[' ) # get data from file -eprint( "opening: "+fn ) +# ~ eprint( "opening: "+fn ) with open( fn, 'r' ) as fp: for place in fp: #error handling: expect arrAddress = place.split(";") - strAddress1 = str(" ".join(arrAddress[1:2])) - eprint( "… "+strAddress1 ) + strAddress1 = arrAddress[1]+" "+arrAddress[2] strAddress2 = ",".join(arrAddress[3:5]) - eprint( "… "+strAddress2 ) strAddress = strAddress1+","+strAddress2 eprint( "looking up: "+strAddress ) location = geolocator.geocode( strAddress ) if location is not None: # its a class # todo: ceil coords to hide true location in format string # ~ strCoordPlace = '{:s},{:.6f},{:.6f}'.format( arrAddress[3], location.latitude, location.longitude ) - geojson = '{{"type":"Feature","geometry":{{"type":"Point","coordinates":[{:.'+str(precision)+'f},{:.'+str(precision)+'f}]}},"properties":{{"name":"anonentry","title":"{:s}","marker":"{:s}"}}}}'; - strCoordPlace = geojson.format( location.longitude, location.latitude, arrAddress[4], fn.split("-")[0] ) + geojson = '{{"type":"Feature","geometry":{{"type":"Point","coordinates":[{:.'+str(precision)+'f},{:.'+str(precision)+'f}]}},"properties":{{"name":"anonentry","marker":"veb-it"}}}}'; + strCoordPlace = geojson.format( location.longitude, location.latitude ) if firstline == False : print (",") else: