def to_geojson(shapes, buildings):
    """Converts the shapes into geojson.
    This function will combine the burn scar region and buildings into geojson.
    Burn scar polygon in red, buildings polygon all in blue."""

    #append burn scar region polygons to geojson
    if type(shapes) == list:
        results = ({
            'type': 'Feature',
            'properties': {'raster_val': v, 'color': 'red'},
            'geometry': s.__geo_interface__}
            for i, (s, v)
            in enumerate(shapes))
    else:
        results = ({
            'type': 'Feature',
            'properties': {'raster_val': v, 'color': 'red'},
            'geometry': s}
            for i, (s, v)
            in enumerate(shapes))

    list_results = list(results)

    # append the building footprints to geojson
    results_buildings = ({
        'type': 'Feature',
        'properties': {'BuildingID': b['properties']['BuildingID'], 'color': 'blue'},
        'geometry': b['geometry']}
        for i, b
        in enumerate(buildings['features']))

    list_results_buildings = list(results_buildings)

    collection = {
        'type': 'FeatureCollection',
        'features': list_results + list_results_buildings}

    return collection