Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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