Skip to content

Instantly share code, notes, and snippets.

@jzuern
Created September 6, 2021 08:50
Show Gist options
  • Save jzuern/0d2bc84753fcc72233211e25bb47adfb to your computer and use it in GitHub Desktop.
Save jzuern/0d2bc84753fcc72233211e25bb47adfb to your computer and use it in GitHub Desktop.
from nuscenes.map_expansion.map_api import NuScenesMap
import matplotlib.pyplot as plt
nuscenes_dataroot = "/path/to/nuscenesroot/v1.0-trainval/"
map_name = "boston-seaport"
# Map object
nusc_map = NuScenesMap(map_name=map_name,
dataroot=nuscenes_dataroot)
# Visualize the map
nusc_map.render_centerlines(resolution_meters=0.5, figsize=1)
plt.show()
# Example of lane connectivity API usage
x, y = 1428, 1263
closest_lane = nusc_map.get_closest_lane(x, y, radius=2)
print(closest_lane)
print("Incoming lane IDs: ", nusc_map.get_incoming_lane_ids(closest_lane))
print("Outgoing lane IDs: ", nusc_map.get_outgoing_lane_ids(closest_lane))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment