fix GeoJSON: lat/lng order and geojson “header”

This commit is contained in:
vv01f 2019-06-07 14:25:50 +02:00
parent 31d357bc31
commit 24cb63ad2b
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ precision = 2
firstline = True
# start json list
print ( "[" )
print ( '{"type":"FeatureCollection","features":[' )
# get data from file
with open( fn, 'r' ) as fp:
for place in fp:
@ -42,14 +42,14 @@ with open( fn, 'r' ) as fp:
# 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":"{:s}","marker":"{:s}"}}}}';
strCoordPlace = geojson.format( location.latitude, location.longitude, arrAddress[1], fn.split("-")[0] )
strCoordPlace = geojson.format( location.longitude, location.latitude, arrAddress[1], fn.split("-")[0] )
if firstline == False :
print (",")
else:
firstline = False
print ( strCoordPlace )
# end json list
print ( "]" )
print ( "]}" )
# exit fine
sys.exit(0)