def _generate_sidewalk_from_line(self, lane, sidewalk_height=None, lateral_direction=1):
        """
        Construct the sidewalk for this lane
        Args:
            block:

        Returns:

        """
        if str(lane.index) in self.sidewalks:
            logger.warning("Sidewalk id {} already exists!".format(str(lane.index)))
            return
        polygon = []
        longs = np.arange(
            0, lane.length + PGDrivableAreaProperty.SIDEWALK_LENGTH, PGDrivableAreaProperty.SIDEWALK_LENGTH
        )
        start_lat = +lane.width_at(0) / 2 + 0.2
        side_lat = start_lat + PGDrivableAreaProperty.SIDEWALK_WIDTH
        assert lateral_direction == -1 or lateral_direction == 1
        start_lat *= lateral_direction
        side_lat *= lateral_direction
        if lane.radius != 0 and side_lat > lane.radius:
            logger.warning(
                "The sidewalk width ({}) is too large."
                " It should be < radius ({})".format(side_lat, lane.radius)
            )
            return
        for k, lateral in enumerate([start_lat, side_lat]):
            if k == 1:
                longs = longs[::-1]
            for longitude in longs:
                longitude = min(lane.length + 0.1, longitude)
                point = lane.position(longitude, lateral)
                polygon.append([point[0], point[1]])
        self.sidewalks[str(lane.index)] = {
            "type": MetaDriveType.BOUNDARY_SIDEWALK,
            "polygon": polygon,
            "height": sidewalk_height
        }

        Construct the sidewalk for this lane
        Args:
            block:

        Returns:

        
metadrive/component/pgblock/pg_block.py