Skip to content

Commit

Permalink
refactor: Pipeline usage of the api
Browse files Browse the repository at this point in the history
  • Loading branch information
r-leyshon committed Nov 8, 2023
1 parent 8463152 commit 398fd7c
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions notebooks/osm/01-visualise-osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# %%
from pyprojroot import here
from transport_performance.osm import validate_osm as osmval
from transport_performance.osm.validate_osm import _convert_osmdict_to_gdf

# %%
fix_pth = here("tests/data/newport-2023-06-13.osm.pbf")
Expand All @@ -11,22 +10,19 @@
# get some Node IDs to work with
ids = osmval.FindIds(fix_pth)
ids.get_feature_ids()
node_IDs = ids.id_dict["node_ids"][0:1000]
node_ids = ids.id_dict["node_ids"][0:1000]
# get a way ID to work with
way_ids = ids.id_dict["way_ids"][0:1]

# %%
# get the locations
# find all location data in the fixture file
locs = osmval.FindLocations(fix_pth)
node_coords = locs.check_locs_for_ids(node_IDs, "node")["node"]


# %%
nodes_gdf = _convert_osmdict_to_gdf(node_coords)
nodes_gdf.explore()

# plot the subset of node IDs
locs.plot_ids(ids=node_ids, feature_type="node")

# %%
way_ids = ids.id_dict["way_ids"][0:1]
way_coords = locs.check_locs_for_ids(way_ids, "way")["way"]
# plot the selected way ID
locs.plot_ids(ids=way_ids, feature_type="way")

# %%
ways_gdf = _convert_osmdict_to_gdf(way_coords, "way")
ways_gdf.explore()

0 comments on commit 398fd7c

Please sign in to comment.