From 24cb63ad2b241adf780869ee1d6bd0068b370121 Mon Sep 17 00:00:00 2001 From: vv01f Date: Fri, 7 Jun 2019 14:25:50 +0200 Subject: [PATCH] =?UTF-8?q?fix=20GeoJSON:=20lat/lng=20order=20and=20geojso?= =?UTF-8?q?n=20=E2=80=9Cheader=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lookup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lookup.py b/lookup.py index 8a37770..a7bb475 100755 --- a/lookup.py +++ b/lookup.py @@ -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)