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
|
firstline = True
|
||||||
# start json list
|
# start json list
|
||||||
print ( "[" )
|
print ( '{"type":"FeatureCollection","features":[' )
|
||||||
# get data from file
|
# get data from file
|
||||||
with open( fn, 'r' ) as fp:
|
with open( fn, 'r' ) as fp:
|
||||||
for place in 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
|
# 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":"{:s}","marker":"{:s}"}}}}';
|
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 :
|
if firstline == False :
|
||||||
print (",")
|
print (",")
|
||||||
else:
|
else:
|
||||||
firstline = False
|
firstline = False
|
||||||
print ( strCoordPlace )
|
print ( strCoordPlace )
|
||||||
# end json list
|
# end json list
|
||||||
print ( "]" )
|
print ( "]}" )
|
||||||
|
|
||||||
# exit fine
|
# exit fine
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue