fix hauseno

This commit is contained in:
vv01f 2020-01-31 01:29:08 +01:00
parent 8fd1b9e246
commit a6e23b72ab
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 4 additions and 6 deletions

View File

@ -37,23 +37,21 @@ firstline = True
# start json list # start json list
print ( '{"type":"FeatureCollection","features":[' ) print ( '{"type":"FeatureCollection","features":[' )
# get data from file # get data from file
eprint( "opening: "+fn ) # ~ eprint( "opening: "+fn )
with open( fn, 'r' ) as fp: with open( fn, 'r' ) as fp:
for place in fp: for place in fp:
#error handling: expect #error handling: expect
arrAddress = place.split(";") arrAddress = place.split(";")
strAddress1 = str(" ".join(arrAddress[1:2])) strAddress1 = arrAddress[1]+" "+arrAddress[2]
eprint( ""+strAddress1 )
strAddress2 = ",".join(arrAddress[3:5]) strAddress2 = ",".join(arrAddress[3:5])
eprint( ""+strAddress2 )
strAddress = strAddress1+","+strAddress2 strAddress = strAddress1+","+strAddress2
eprint( "looking up: "+strAddress ) eprint( "looking up: "+strAddress )
location = geolocator.geocode( strAddress ) location = geolocator.geocode( strAddress )
if location is not None: # its a class if location is not None: # its a class
# todo: ceil coords to hide true location in format string # todo: ceil coords to hide true location in format string
# ~ strCoordPlace = '{:s},{:.6f},{:.6f}'.format( arrAddress[3], location.latitude, location.longitude ) # ~ 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}"}}}}'; 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, arrAddress[4], fn.split("-")[0] ) strCoordPlace = geojson.format( location.longitude, location.latitude )
if firstline == False : if firstline == False :
print (",") print (",")
else: else: