This is my current geojson effect
This is the geojson effect that I expect, the color doesn’t matter, the important thing is that it’s connected.
I tried using gdal:
bash
docker run --rm -v $(pwd):/data ghcr.io/osgeo/gdal:alpine-normal-latest
ogr2ogr -f GeoJSON /data/Zones_merged.geojson /data/Zones_smoothed.geojson
-dialect sqlite -sql "SELECT ST_Union(geometry) AS geometry, AVG(DEPTH2D) AS DEPTH2D
FROM Zones AS a
WHERE EXISTS (
SELECT 1 FROM Zones AS b
WHERE ST_Intersects(ST_Buffer(a.geometry, 0.1), b.geometry)
AND ABS(a.DEPTH2D - b.DEPTH2D) <= 15
)
GROUP BY a.rowid"
I have also used python,geopandas。