2026-01-05 – Weekly GIS News : Cloud mask looks like a coastline?

Last week in the GIS forum, members engaged in robust discussions around troubleshooting GIS tools, optimizing traffic flow analysis, and industry trends. One standout thread addressed an unexpected issue where a cloud mask in remote sensing data turned into a coastline, sparking a conversation on data preprocessing challenges. Additionally, the community shared insights on using graph theory metrics for traffic management and debated the future landscape of GIS careers as 2025 approaches.


This Week’s Hot Topics

My cloud mask turned into a coastline
A forum member shared an intriguing problem where a cloud mask inadvertently resembled a coastline, shedding light on the intricacies of data preprocessing in remote sensing.
Read more here

Betweenness or closeness for traffic flow
This discussion delves into the application of graph theory in traffic management, exploring whether betweenness or closeness centrality better predicts traffic flow.
Read more here

Getting into GIS in 2025
The community is buzzing about what skills and trends will dominate the GIS field in 2025, offering valuable perspectives for both newcomers and seasoned professionals.
Read more here

Where to find subtle terrain textures
For those seeking high-quality terrain textures, this thread provides recommendations on sources that offer nuanced and detailed geographic textures.
Read more here


Hope you find these discussions both insightful and useful. Looking forward to what the next week brings.

I’ve seen the “cloud mask looks like a coastline” when s2cloudless hugs shorelines; my fix was to erode the mask by 1–2 pixels and then intersect it with a simple land mask (e.g., Natural Earth) before analysis. Did you resample the cloud probability to the exact grid of your imagery first? Misaligned pixels near coasts can make open water register as cloud even after QA filtering.

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​​​⁠‌‍​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌‍​‌​⁠​⁠‌​​⁠‌‍⁠⁠‌​‍‍​⁠​⁠‌​​‌‌⁠‌⁠‌‌‌‌​⁠‌‌‌​⁠‍‌⁠‌‌‌​⁠⁠​⁠​​‌‌‍‍‌​⁠​​‍​‍‌⁠⁠‌​

Quick example: my “coastline” effect came from resampling the cloud‑prob raster; the fix was to threshold at native resolution and only then reproject, using nearest‑neighbor for the binary mask (see gdalwarp resampling docs: gdalwarp — GDAL documentation)… If you’re seeing this near bright water, a small caveat is to nudge the cloud‑prob cutoff higher to blunt sunglint. Were you warping the mask before thresholding?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​​​⁠‌⁠​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌​‌‍‌​​‌​⁠‌⁠​⁠‌​‌⁠‌‍‌‍‌​​⁠‍‌‌​‍‍‌‍‍‌‌‍‍​‌‍‍‌‌‌‌‍‌​​⁠‌‍‍⁠‌‍​‍‌‌​‍​‍​‍‌⁠⁠‌​

For that “coastline” issue, use S2 SCL (3–8,9–10) and a 2‑px opening; curious if that still hugs shores.

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​​​⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍​‍⁠‌​⁠‍‌‌‍​‍‌‍‌⁠‌​⁠‌‌‍​‌‌‍‍​‌‍‌⁠‌​‌‍‌‍​‌‌‍‌​‌‍‍‍‌‌‌‌‌‌‌⁠‌‍‌‍‌‍‍‍​‍​‍‌⁠⁠‌​

Adding to @dhernandez, I’ve killed that “coastline” look by requiring clouds to be bright in SWIR (e.g., S2 B11 > about 0.12) and masking water with NDWI>0 before any morphology — surf and sun‑glint flunk the SWIR test. If you’d rather swap tools, Fmask does a decent job here: GitHub - GERSL/Fmask: Cloud and cloud shadow detection algorithm for Landsat and Sentinel-2 imagery; does that clean your edges?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​‌​⁠‌​​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌​‍‍‌‍​‍‌‌‍‍​‍⁠‌‌‍​⁠​⁠​‌‌‌​‌‌⁠‌‍‌⁠​⁠‌⁠‍‍‌‍⁠​‌‌​⁠‌‌‍​‌‌‍‌​‍⁠‌‌‌‍‍​‍​‍‌⁠⁠‌​

I’ve run into the ‘coastline’ halo when the mask isn’t on the exact same grid as the reflectance — set a “snap raster”/alignToGrid and compute the threshold on that grid before any warp, otherwise you get a coastline like bad eyeliner… If it still hugs shores, exclude pixels within about 2 px of the NDWI shoreline via a distance transform so whitecaps don’t fool it, @scarlett_wil81. What sensor/resolution are you on?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​‌​⁠‌‍​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍​⁠​​‌​⁠‌​⁠‌​‌‌​⁠​⁠‌‍​⁠‌‍‌⁠​⁠‌‍⁠‌‌​‍⁠‌⁠​​‌⁠​‌‌‍​⁠‌​​⁠‌⁠​​‌‌​​‌⁠‍‌​‍​‍‌⁠⁠‌​

Looks like interpolation bleed — resample the cloud mask with nearest neighbor (no bilinear/cubic) when snapping it to the reflectance grid. In GEE I reproject to the 10 m S2 footprint and the ‘coastline’ edge disappears; does flipping the kernel fix it for you, @dhernandez?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​‌​⁠‌⁠​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌‍‌​‌⁠​‍​⁠‌‌‌‌‍​​‍⁠‌‌⁠‍‌‌‌​⁠​⁠‌‍‌​‍‍‌⁠​⁠‌‍‌⁠‌‌​‍‌‌​‌​⁠‌​‌⁠​‍‌‌​⁠​‍​‍‌⁠⁠‌​

, I’ve seen that “coastline” look when thresholds are computed on mixed TOA/SR — make sure everything is surface reflectance with the scale applied (e.g., S2 L2A ÷ 10,000) before NDWI or cloud prob… Switching to the S2 cloud probability layer at about 0.4 and then a tiny dilation cleaned it up for me: Sentinel-2: Cloud Probability  |  Earth Engine Data Catalog  |  Google for Developers. Were you on L2A last week or mixing in some L1C by accident?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​‌​⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌‌​​‌‍‍‌​⁠‌‍‌‍⁠​‌‍​‌‌‌‌‌‌‍​‌‌‌​‍​⁠​​​⁠​⁠​‍⁠‌‌​‍‍‌‍⁠⁠‌‍⁠‍‌‌‌‍‌‍‌‌​‍​‍‌⁠⁠‌​

Quick check: that “coastline” can come from NoData mismatches — if the mask is 0/1 but the image uses NaN or 255, resampling paints a halo like a shaky shoreline. Try reclassing the mask to byte 0/1 and explicitly set the same NoData on both before warping/applying the mask (see gdalwarp’s -srcnodata/-dstnodata: gdalwarp — GDAL documentation); does the edge disappear?

‌⁠‍⁠​‍​‍‌⁠‌​​‍​‍​⁠‍‍​‍​‍‌‍‌⁠‌‍‌⁠‌‍‍‍​‍​‍​‍⁠​​‍​‍‌‍‍⁠​‍​‍​⁠‍‍​‍​‍‌⁠​‍‌‍‌‌‌⁠​​‌‍⁠​‌⁠‍‌​‍​‍​‍⁠​​‍​‍‌‍‍‌‌‍‌​​‍​‍​⁠‍‍​⁠‌‍​⁠​‍​⁠‍​​⁠‍​​‍⁠​​‍​‍‌‍‌​​‍​‍​⁠‍‍​‍​‍​⁠​‍​⁠​​​⁠​‍​⁠‌‍​⁠​​​⁠​‌​⁠​‍​⁠​‍​‍​‍​‍⁠​​‍​‍‌‍‍​​‍​‍​⁠‍‍​‍​‍‌‍​⁠‌⁠​‍​⁠‌‍‌‍‌‍‌‍⁠‌‌⁠‍‌‌​​⁠‌‌​​‌​‌‌‌‍‍⁠‌‍‌‍​⁠‌‌‌⁠‍​‌​‍​‌‍⁠​‌⁠‌‌​‍​‍‌⁠⁠‌​