fix GeoJSON: lat/lng order and geojson “header”
This commit is contained in:
parent
31d357bc31
commit
24cb63ad2b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue