Exemplo n.º 1
0
}

# [OPTIONAL] preprocess images (cloud masking, pansharpening/down-sampling)
SDS_preprocess.save_jpg(metadata, settings)

# [OPTIONAL] create a reference shoreline (helps to identify outliers and false detections)
settings['reference_shoreline'] = SDS_preprocess.get_reference_sl(
    metadata, settings)
# set the max distance (in meters) allowed from the reference shoreline for a detected shoreline to be valid
settings['max_dist_ref'] = 100

# extract shorelines from all images (also saves output.pkl and shorelines.kml)
output = SDS_shoreline.extract_shorelines(metadata, settings)

# remove duplicates (images taken on the same date by the same satellite)
output = SDS_tools.remove_duplicates(output)
# remove inaccurate georeferencing (set threshold to 10 m)
output = SDS_tools.remove_inaccurate_georef(output, 10)

# plot the mapped shorelines
fig = plt.figure()
plt.axis('equal')
plt.xlabel('Eastings')
plt.ylabel('Northings')
plt.grid(linestyle=':', color='0.5')
for i in range(len(output['shorelines'])):
    sl = output['shorelines'][i]
    date = output['dates'][i]
    plt.plot(sl[:, 0], sl[:, 1], '.', label=date.strftime('%d-%m-%Y'))
plt.legend()
mng = plt.get_current_fig_manager()
Exemplo n.º 2
0
    if int(o.mode) == 1 or int(o.mode) == 3:
        metadata = SDS_download.retrieve_images(inputs)

        # settings for the shoreline extraction

        SDS_preprocess.save_jpg(metadata, settings)
        # [OPTIONAL] create a reference shoreline (helps to identify outliers and false detections)
        settings["reference_shoreline"] = SDS_preprocess.get_reference_sl(
            metadata, settings)
        # set the max distance (in meters) allowed from the reference shoreline for a detected shoreline to be valid
        settings["max_dist_ref"] = 100

        # extract shorelines from all images (also saves output.pkl and shorelines.kml)
        output = SDS_shoreline.extract_shorelines(metadata, settings)
        output = SDS_tools.remove_duplicates(
            output
        )  # removes duplicates (images taken on the same date by the same satellite)
        output = SDS_tools.remove_inaccurate_georef(output, 10)

        # for GIS applications, save output into a GEOJSON layer
        geomtype = "points"  # choose 'points' or 'lines' for the layer geometry
        gdf = SDS_tools.output_to_gdf(output, geomtype)
        gdf.crs = {
            "init": "epsg:" + str(settings["output_epsg"])
        }  # set layer projection
        # save GEOJSON layer to file
        gdf.to_file(
            os.path.join(filepath_data, sitename,
                         "%s_output_%s.geojson" % (sitename, geomtype)),
            driver="GeoJSON",
            encoding="utf-8",