def get_semantic_map(
        self,
        center_point,
        size=512,
        pixels_per_meter=8,
        color_setting=MapTerrainSemanticColor,
        line_sample_interval=2,
        yellow_line_thickness=1,
        white_line_thickness=1,
        layer=("lane_line", "lane")
    ):
        """
        Get semantics of the map for terrain generation
        :param center_point: 2D point, the center to select the rectangular region
        :param size: [m] length and width
        :param pixels_per_meter: the returned map will be in (size*pixels_per_meter * size*pixels_per_meter) size
        :param color_setting: color palette for different attribute. When generating terrain, make sure using
        :param line_sample_interval: [m] It determines the resolution of sampled points.
        :param polyline_thickness: [m] The width of the road lines
        :param layer: layer to get
        MapTerrainAttribute
        :return: semantic map
        """
        center_p = center_point

        # if self._semantic_map is None:
        all_lanes = self.get_map_features(interval=line_sample_interval)
        polygons = []
        polylines = []

        points_to_skip = math.floor(PGDrivableAreaProperty.STRIPE_LENGTH * 2 / line_sample_interval)
        for obj in all_lanes.values():
            if MetaDriveType.is_lane(obj["type"]) and "lane" in layer:
                polygons.append((obj["polygon"], color_setting.get_color(obj["type"])))
            elif "lane_line" in layer and (MetaDriveType.is_road_line(obj["type"])
                                           or MetaDriveType.is_road_boundary_line(obj["type"])):
                if MetaDriveType.is_broken_line(obj["type"]):
                    for index in range(0, len(obj["polyline"]) - 1, points_to_skip * 2):
                        if index + points_to_skip < len(obj["polyline"]):
                            polylines.append(
                                (
                                    [obj["polyline"][index],
                                     obj["polyline"][index + points_to_skip]], color_setting.get_color(obj["type"])
                                )
                            )
                else:
                    polylines.append((obj["polyline"], color_setting.get_color(obj["type"])))

        size = int(size * pixels_per_meter)
        mask = np.zeros([size, size, 1], dtype=np.uint8)
        mask[..., 0] = color_setting.get_color(MetaDriveType.GROUND)
        # create an example bounding box polygon
        # for idx in range(len(polygons)):
        for polygon, color in polygons:
            points = [
                [
                    int((x - center_p[0]) * pixels_per_meter + size / 2),
                    int((y - center_p[1]) * pixels_per_meter) + size / 2
                ] for x, y in polygon
            ]
            cv2.fillPoly(mask, np.array([points]).astype(np.int32), color=color)
        for line, color in polylines:
            points = [
                [
                    int((p[0] - center_p[0]) * pixels_per_meter + size / 2),
                    int((p[1] - center_p[1]) * pixels_per_meter) + size / 2
                ] for p in line
            ]
            thickness = yellow_line_thickness if color == MapTerrainSemanticColor.YELLOW else white_line_thickness
            # thickness = min(thickness, 2)  # clip
            cv2.polylines(mask, np.array([points]).astype(np.int32), False, color, thickness)

        if "crosswalk" in layer:
            for id, sidewalk in self.crosswalks.items():
                polygon = sidewalk["polygon"]
                points = [
                    [
                        int((x - center_p[0]) * pixels_per_meter + size / 2),
                        int((y - center_p[1]) * pixels_per_meter) + size / 2
                    ] for x, y in polygon
                ]
                # edges = find_longest_parallel_edges(polygon)
                # p_1, p_2 = edges[0]
                p_1, p_2 = find_longest_edge(polygon)[0]
                dir = (
                    p_2[0] - p_1[0],
                    p_2[1] - p_1[1],
                )
                # 0-2pi
                angle = np.arctan2(*dir) / np.pi * 180 + 180
                angle = int(angle / 2) + color_setting.get_color(MetaDriveType.CROSSWALK)
                cv2.fillPoly(mask, np.array([points]).astype(np.int32), color=angle)

        #     self._semantic_map = mask
        # return self._semantic_map
        return mask

        Get semantics of the map for terrain generation
        :param center_point: 2D point, the center to select the rectangular region
        :param size: [m] length and width
        :param pixels_per_meter: the returned map will be in (size*pixels_per_meter * size*pixels_per_meter) size
        :param color_setting: color palette for different attribute. When generating terrain, make sure using
        :param line_sample_interval: [m] It determines the resolution of sampled points.
        :param polyline_thickness: [m] The width of the road lines
        :param layer: layer to get
        MapTerrainAttribute
        :return: semantic map
        
metadrive/component/map/base_map.py