Skip to content

Instantly share code, notes, and snippets.

@lmeulen
Created April 4, 2021 11:31
Show Gist options
  • Save lmeulen/b0519a5ef8a3634e2c1176b5c1c95110 to your computer and use it in GitHub Desktop.
Save lmeulen/b0519a5ef8a3634e2c1176b5c1c95110 to your computer and use it in GitHub Desktop.
crowdedness_create_network
network = trips.drop_duplicates('route_id').dropna()
network = network[~(network.trip_long_name == 'Stopbus i.p.v. trein')]
features=[]
for si in network.shape_id.unique():
section = shapes[shapes.shape_id == si]
ls =LineString(section[['shape_pt_lon','shape_pt_lat']].to_numpy().tolist())
features.append(
Feature(geometry=ls, properties=dict(label=str(si)))
)
with open('network.geojson', 'w') as outfile:
dump(FeatureCollection(features), outfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment