Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created March 7, 2020 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheresalice/c051f07c6ede8e6fcbe72df605ba4247 to your computer and use it in GitHub Desktop.
Save wheresalice/c051f07c6ede8e6fcbe72df605ba4247 to your computer and use it in GitHub Desktop.
def states_to_geojson(states):
geojson = {}
geojson['type'] = 'FeatureCollection'
geojson['features'] = []
for state in states.states:
point = {}
point['type'] = 'Feature'
point['properties'] = {'icao': state.icao24, 'callsign': state.callsign, 'origin_country': state.origin_country,
'on_ground': state.on_ground, 'velocity': state.velocity, 'spi': state.spi}
point['geometry'] = {'type': 'Point', 'coordinates': [state.longitude, state.latitude]}
geojson['features'].append(point)
return geojson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment