kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.wrl.unsw.edu.au/
GNU General Public License v3.0
651 stars 245 forks source link

Clipping the output shorelines #501

Open evecchi opened 3 weeks ago

evecchi commented 3 weeks ago

Hi @kvos,

I'm writing you to ask a question about the output geojson and pkl files (SITENAME_output.geojson/pkl). I'm trying to add a new section of the script where the extracted shorelines are clipped basing on a given polygon, to clean possible incorrect points which are not related to the shoreline. Thus, I'm using the output geojson, clipping it using a polygon shapefile and I want to load the clipped geojson back to your script. For the following steps, I would need the clipped output to be read again as a dictionary and as a pkl file, right? But the exported output.geojson seems to have only the following keys: (['type', 'crs', 'features']), and to be not complete having: (['dates', 'shorelines', 'filename', 'cloud_cover', 'geoaccuracy', 'idx', 'MNDWI_threshold', 'satname']).

What do you suggest?

Thank you in advance

Enrica

kvos commented 3 weeks ago

hi @evecchi , I remember there was another issue where someone was loading the geojson in QGIS/Arc, cleaning it up and wanted to continue with the cleaned geometry. I'll flag it as an enhacement. I would suggest that you add a section where you do the follow:

While writing this I'm realising that it may be much easier to bring in your polygon shapefile with geopandas and then clip all the shoreline points based on the polygon. Have a go at either option and let me know if you need help, should be feasible. Also make sure that the coordinate system is not altered when going in and out of QGIS/Arc.

evecchi commented 3 weeks ago

Hi @kvos,

thank you for the advice! The first method is working!!!