def extract_map_features(graph):
    """This func extracts the map features like lanes/lanelines from the SUMO map"""
    from shapely.geometry import Polygon

    ret = {}
    # # build map boundary
    polygons = []

    # for junction_id, junction in graph.junctions.items():
    #     if len(junction.shape) <= 2:
    #         continue
    #     boundary_polygon = Polygon(junction.shape)
    #     boundary_polygon = [(x, y) for x, y in boundary_polygon.exterior.coords]
    #     id = "junction_{}".format(junction.name)
    #     ret[id] = {
    #         SD.TYPE: MetaDriveType.LANE_SURFACE_STREET,
    #         SD.POLYLINE: junction.shape,
    #         SD.POLYGON: boundary_polygon,
    #     }

    # build map lanes
    for road_id, road in graph.roads.items():
        for lane in road.lanes:

            id = "lane_{}".format(lane.name)

            boundary_polygon = [(x, y) for x, y in lane.shape.shape.exterior.coords]
            if lane.type == 'driving':
                ret[id] = {
                    SD.TYPE: MetaDriveType.LANE_SURFACE_STREET,
                    SD.POLYLINE: lane.sumolib_obj.getShape(),
                    SD.POLYGON: boundary_polygon,
                }
            elif lane.type == 'sidewalk':
                ret[id] = {
                    SD.TYPE: MetaDriveType.BOUNDARY_SIDEWALK,
                    SD.POLYGON: boundary_polygon,
                }
            elif lane.type == 'shoulder':
                ret[id] = {
                    SD.TYPE: MetaDriveType.BOUNDARY_SIDEWALK,
                    SD.POLYGON: boundary_polygon,
                }
            elif lane.type == 'crossing':
                print('hello')
                ret[id] = {
                    SD.TYPE: MetaDriveType.CROSSWALK,
                    SD.POLYGON: boundary_polygon,
                }

    for lane_divider_id, lane_divider in enumerate(graph.lane_dividers):
        id = "lane_divider_{}".format(lane_divider_id)
        ret[id] = {SD.TYPE: MetaDriveType.LINE_BROKEN_SINGLE_WHITE, SD.POLYLINE: lane_divider}

    for edge_divider_id, edge_divider in enumerate(graph.edge_dividers):
        id = "edge_divider_{}".format(edge_divider_id)
        ret[id] = {SD.TYPE: MetaDriveType.LINE_SOLID_SINGLE_YELLOW, SD.POLYLINE: edge_divider}

    return ret
This func extracts the map features like lanes/lanelines from the SUMO map
metadrive/utils/sumo/map_utils.py