From dc8531462afac8fc13d84dbfa502449ac5672f31 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 9 Aug 2018 12:33:55 +1000 Subject: [PATCH] Smooth swash cropping polygon to remove invalid geometry --- las_manipulation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/las_manipulation.py b/las_manipulation.py index 9a44b67..7fc5357 100644 --- a/las_manipulation.py +++ b/las_manipulation.py @@ -350,8 +350,11 @@ def polygon_wave_runup(xyz_1m, direction, shp_name, set_check_value, distance_ch #making the cropping shapefile #print('making the crop polygon') + # Simplify polygon to remove invalid geometry + geom = Polygon(for_shape).simplify(10) + # Export polygon as shapefile - df = gpd.GeoDataFrame(geometry=[Polygon(for_shape)]) + df = gpd.GeoDataFrame(geometry=[geom]) df.crs = {'init': 'epsg:283{}'.format(zone), 'no_defs': True} df.to_file(shp_name, driver='ESRI Shapefile')