def shapes_to_geojson(
    feed: "Feed", shape_ids: Optional[List[str]] = None
) -> Dict:
    """
    Return a (decoded) GeoJSON FeatureCollection of LineString features
    representing ``feed.shapes``.
    Each feature will have a ``shape_id`` property.
    The coordinates reference system is the default one for GeoJSON,
    namely WGS84.

    If a list of shape IDs is given, then return only the LineString
    features corresponding to those shape IDS.
    Return the empty dictionary if ``feed.shapes is None``
    """
    geometry_by_shape = feed.build_geometry_by_shape(shape_ids=shape_ids)
    if geometry_by_shape:
        fc = {
            "type": "FeatureCollection",
            "features": [
                {
                    "properties": {"shape_id": shape},
                    "type": "Feature",
                    "geometry": sg.mapping(linestring),
                }
                for shape, linestring in geometry_by_shape.items()
            ],
        }
    else:
        fc = {}
    return fc
Return a (decoded) GeoJSON FeatureCollection of LineString features
    representing ``feed.shapes``.
    Each feature will have a ``shape_id`` property.
    The coordinates reference system is the default one for GeoJSON,
    namely WGS84.

    If a list of shape IDs is given, then return only the LineString
    features corresponding to those shape IDS.
    Return the empty dictionary if ``feed.shapes is None``