S-LiNE is an open-source toolbox for detecting shoreline positions from UAV and ALS LiDAR point clouds. It combines automated and semi-automated workflows based on elevation, intensity, RGB, scan angle characteristics, and point cloud classification.
- Correction of UAV LiDAR data to local geoid (e.g. EPSG:2180)
- Detection of shoreline based on point density & intensity, RGB color filtering (suitable for UAV), classified LiDAR (ALS)
- Calculation of Shoreline Change Envelope (SCE) statistics
- Batch processing mode
- Visualization modules
- Export results to GeoJSON / Shapefile formats
- Integrated download and installation of demo datasets.
π S-LiNE
β£ π tools
β β£ step0_demo-data.py
β β£ step1_data_preparation.py
β β£ step2_shoreline_detection.py
β β£ step3_stats.py
β β£ step4_animation.py
β β£ step5_scanline_detection.py
β β step6_rgb_shoreline.py
β£ π input
β β£ π las #raw las files from UAV LiDAR
β β£ π las_geoid #las files from step 1 to further preprocessing in steps 2-5, and 6
β β£ π las_class #raw las files ALS LiDAR
β β π geoid #CSV files with GEOID value
β£ π output
β β£ π sce
β β π png
β app.py
The application requires Python 3.9+ and the following packages:
- streamlit
- pandas
- numpy
- laspy
- scipy
- geopandas
- matplotlib
- scikit-image
- networkx
- shapely
- geojson
- fiona
- Pillow
- requests
- streamlit-sortables
- Clone the repository:
git clone https://github.com/Baltic-Coastal-Monitoring-Team/S-LiNE.git
cd S-LiNE
- Create and activate the environment:
conda env create -f environment.yml
conda activate s-line
If you already have an environment named s-line, you may need to remove it first:
conda env remove -n s-line
- Run the application:
Navigate to the project folder and run: streamlit run app.py
\n
The app will launch in your browser at http://localhost:8501
.
Demo datasets available:
Demo files require a different approach to help you understand how the application works. Below is a step-by-step guide.
- Load demo files or place your own
.las
files in theinput/las
folder. - If using demo data from UAV, first perform geoid correction (via Step 1 β Data Preparation).
- Important: To properly use the demo data, you also need to download the example geoid model.
- In the application, go to the "Demo Data" tab and click "Download Geoid Model".
- The CSV file (42 MB) will be automatically saved into the
input/geoid
folder. - The provided model corresponds to the EPSG:2180 coordinate system (national geoid model for Poland).
Note: If you want to use your own geoid model, you can place any compatible CSV file manually in the
input/geoid
directory.
Geoid model usage
- Select an individual LAS file and the corresponding geoid file.
- Important: The LAS and geoid files must have the same coordinate system. Reprojection is not handled automatically.
- You can batch-process multiple LAS files if needed.
- Height filtering applied to limit points near shoreline level (default Z β€ 2.0 m).
- Intensity histogram calculated on filtered subset.
- Otsu's method computes automatic threshold by minimizing intra-class variance.
- Local minimum near Otsu Β±10 bins determines suggested threshold.
- User can manually override threshold and comparison operator (> or <).
- Filtered points are binned spatially; Canny edge detection applied on point count grid.
- KDTree-based neighbor filtering removes unstable edge points.
- Scan angle filtering (default 15Β°) removes high-angle returns.
Parameter reference
Parameter | Default | Description |
---|---|---|
Z max threshold for preview | 2.0 | Maximum elevation (Z) to filter points used for intensity histogram preview. Used to exclude higher inland points. |
Grid cell size | 0.50 | Spatial resolution (in meters) used for gridding point density and intensity maps. |
Min intensity / Max intensity | 0 / 255 | Optional range filter for intensity values shown in preview histogram. It is recommended to reduce the Max intensity if good results are not achieved. In the demo files, the maximum value was set to 80. |
Dynamic Z Level | 0,65 (auto) | Elevation threshold used for shoreline point extraction; if 0, estimated from high-intensity elevation distribution. If the height is known from ground measurements (e.g., from GNSS RTK), this parameter should be entered. The default value is 0.65, but it should be adjusted for each measurement. |
Scan angle threshold (deg) | 15 | Minimum absolute scan angle required to include points; filters out near-nadir and extremely oblique returns. |
Max return number | 1 | Filters multiple returns; only keeps first returns for more reliable shoreline mapping. |
Auto threshold for intensity (Otsu) | Enabled | Enables automatic thresholding using Otsu's method on intensity values. |
Manual intensity threshold | 85 | Used when Otsu is disabled; user sets absolute threshold value. |
Intensity comparison operator | > |
Determines whether shoreline is extracted from points above or below the threshold (> or < ). |
Suggested settings for demo files:
File: 2023-12-16_geoid.las
- Go to Intensity preview tab.
- Use default settings and click Generate intensity preview.
- Check suggested parameters.
- Switch to Detection tab.
- Uncheck "Auto threshold for intensity (Otsu)".
- Click Run detection.
File: 2024-01-29_geoid.las
- In Intensity preview, default settings will show poor contrast.
- Adjust Max intensity to 80.
- Preview again β parameters should now look good.
- In Detection tab, check if suggested parameters are selected and set Intensity comparison to
<
and click Run detection again. - Now the shoreline line should be correctly detected.
File: 2024-03-27_geoid.las
- Adjust Max intensity to 80 in the Intensity preview.
- In the Detection tab, use the suggested auto parameters but switch Intensity comparison to
<
.
- For dune coastlines, start with the Beach (sandy) preset.
- Adjust minimum and maximum height filters individually for each file.
- Fine-tune smoothing for the best visual results.
First click Preview filter button and check your histograms. Next set min to value that is visible on the beginning of all histograms, and max to value that is visible on the end of all histograms.
- Height filtering applied using user-specified Z min and Z max.
- Manual threshold ranges for Red, Green, and Blue channels define color filtering mask.
- Presets (Beach (sandy)) are optimized for typical dry sand / wet sand contrast for Baltic Sea, where all colors are set to default values (min. 30000 and max. 65535).
- Filtered points are grouped into bins along X axis.
- In each bin, either the highest (upper) or lowest (lower) Y-coordinate is selected.
- Gaussian smoothing is applied to stabilize shoreline geometry.
- No automatic clustering or histogram-based thresholding is applied β user fully controls thresholds interactively.
Parameter | Default | Description |
---|---|---|
Edge mode | upper |
Selects which point in each bin is taken as shoreline candidate (uppermost, lowermost). |
Red min / max | - | User-defined min and max thresholds for Red channel (from 0 to 65535). |
Green min / max | - | User-defined min and max thresholds for Green channel. (from 0 to 65535). |
Blue min / max | - | User-defined min and max thresholds for Blue channel. (from 0 to 65535). |
Z min / max | 0 / 1.0 | Elevation filtering window to exclude irrelevant inland or water points. |
Resolution (bin size) | 1.0 | Bin size for edge detection grid. |
Smoothing (sigma) | 2.0 | Gaussian smoothing applied to stabilize shoreline polyline. Higher numbers create more smooth line, but results could be less accurate |
Suggested settings for demo files:
File | Preset | Notes |
---|---|---|
2023-12-16_geoid.las |
Beach (sandy) | Adjust min. height to -0,37 and max. heigt to 2,40 , adjust smoothing (default 2 or higher) |
2024-01-29_geoid.las |
Beach (sandy) | Adjust minimum height to 0,64 and max. heigt to 2,40 |
2024-03-27_geoid.las |
None | Manually adjust RGB ranges (min: 51000, max: 65535), set smoothing ~5 |
- Select reference and comparison shorelines.
- Set transect spacing (default: 1 m).
- Outputs:
- Table with distance values and summary statistics.
- Distance plot and quick shoreline overlay.
- Shoreline overlay on DEM (you can adjust DEM resolution).
- Shoreline Change Envelope (SCE) method based on transect sampling.
- Virtual transects are generated perpendicular to the reference shoreline.
- Distances to comparison shoreline are calculated along each transect.
- Output includes profile-by-profile distance table, average, maximum, and summary statistics.
- Results are visualized both as plots and overlayed shoreline maps.
- Select the sequence of shorelines to animate.
- Adjust:
- DPI resolution (A higher value will create a target file with high resolution and size),
- Frame interval (Speed in seconds - default is 1 second),
- Line thickness (This parameter affects the final visualization of the lines and depends on the area of investigation and the line density).
- The animation will be saved automatically into the
output
folder.
- Load ALS demo files or place your own
.las
files intoinput/las_class
. - Select a file.
- Click Run detection.
- The result will be saved as a
.geojson
file in theoutput
folder. - Optionally, check the Export to SHP box to also generate a shapefile.
- LAS files classified according to ASPRS codes: ground (class 2), water (class 9).
- Ground-class points are divided into spatial bins (X or Y axis depending on orientation).
- In each bin, extreme point is selected (upper, lower).
- Automatic binning direction selected based on centroid displacement of ground and water points.
- Gaussian smoothing is applied to stabilize shoreline polyline.
- No additional intensity, RGB, or elevation filters are used.
Parameter | Default | Description |
---|---|---|
Edge mode | auto |
Determines which direction to bin (upper, lower, left, right) based on ground vs water centroid displacement. |
Smoothing (sigma) | 2.0 | Gaussian smoothing applied to extracted shoreline. Higher numbers create more smooth line, but results could be less accurate |
Export to SHP | Disabled | If enabled, result saved both as GeoJSON and SHP. |
The shoreline positions extracted by S-LiNE are dependent on the instantaneous water level at the time of LiDAR data acquisition. Tidal stage, storm surge, wind setup, and hydrodynamic fluctuations can temporarily shift the observed shoreline position. This effect is typically limited in microtidal environments such as the Baltic Sea (the primary study region), but may be significant in other coastal systems. The software does not include automated tidal normalization or hydrodynamic corrections. Users working in highly tidal regions should apply external water level corrections if required.
This application is under active development. Upcoming features may include:
- LAZ file support (ALS)
- Quickly preview of data with WMS background map
- LAS/LAZ inspector
- Flight Coverage Map
- All GeoJSON Layers Viewer
- Detection of the base and crest of a sand dune on a sandy coast;
- Detection of the coastline and the crest and base of a cliff on a cliff coast.
- Additional data visualisations to support decision-making processes.
Jakub Εledziowski, PaweΕ Terefenko, Andrzej Giza from University of Szczecin / Baltic Coastal Monitoring Team
MIT License