Model or dataset
coolzhao/Geo-SAM avatar
coolzhao/Geo-SAM

Geo-SAM: Interactive SAM Segmentation Inside QGIS, With the Image Encoder Split Out

A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.

423 stars55 forksPythonMIT

At a glance

What is it?
Geo-SAM is a QGIS plugin that wraps SAM, SAM 2, SAM 2.1 and SAM 3 for landform delineation on geospatial rasters. Its core trick is encoding image features ahead of prompting, and the v2.0 release adds a live encoding mode that removes the pre-encoding step for exploratory work.
Who is it for?
Adopt Geo-SAM if you already work in QGIS and want SAM masks as editable vector polygons without leaving the canvas. Do not adopt it if you need automated, prompt-free segmentation across thousands of scenes, because every mask here starts from a human click.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 70 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The Problem: SAM Is Fast at Inference and Slow at Everything Around It

Segment Anything produces masks from prompts (points, boxes) rather than from labels. For a remote sensing analyst tracing glaciers, lakes or debris-covered ice, that is attractive: no training set, no class taxonomy, just click and get an outline. The friction sits in the plumbing. The original SAM pipeline encodes the prompt and the image together, so every new click on the same scene re-runs the heavy image encoder. On a large raster that is the expensive part, and it is repeated for every object you want to delineate. Geo-SAM's stated approach is to encode image features in advance and query prompts against the cached features, which the README describes as running at millisecond speeds on a laptop CPU. The audience is narrow and specific: someone already inside QGIS who needs vector polygons from imagery and would otherwise hand-digitize them. It is not a training framework and it does not produce a classification model you can deploy elsewhere.

Two Encoding Paths, and Why the Choice Matters More Than the Model

Since v2.0 the plugin exposes two workflows. Live Encoding mode takes a raster layer and a SAM model, starts segmenting immediately, and encodes features on the fly using QGIS background tasks, caching them so repeat queries on the same view are fast. Pre-encoded mode uses a separate Image Encoder tool to write reusable feature files that the Segmentation tool then loads. The trade-off is straightforward. Live mode removes a setup step but spends compute on the first query for each scene, and the cache is the only thing standing between you and re-encoding. Pre-encoded mode front-loads the cost into a file you can reuse across sessions, which is what you want when the same image will be segmented repeatedly. The README frames pre-encoded mode as best for repeated segmentation of the same image, and that is the honest characterisation: the two modes are not a quality difference, they are a caching strategy difference. The repository also credits a separate geosam core library as the backbone since v2.0, replacing the previous internal implementation.

Model Families, Vectorization Modes and the Max Polygon Switch

The v2.0 release notes list support for SAM, SAM 2, SAM 2.1 and SAM 3 model families, with the quick start guide pointing at SAM2.1 Base as an example download. Model weights are fetched through the plugin rather than by the user running pip or curl. Output can be vectorized as Pixel-Level polygons or Simplified polygons, and a Max Polygon Only mode keeps just the largest polygon from each mask. That last option is a quiet admission about SAM's behaviour on remote sensing imagery: point prompts on a heterogeneous scene often return several disconnected regions, and for a single landform you usually want one. Whether Max Polygon Only is the right default depends on your target. For a lake or a glacier terminus it probably is. For scattered supraglacial ponds it is the wrong switch, because it will silently discard every pond except the largest. The documentation does not, from the material available here, describe how Simplified polygonization is computed or what tolerance it applies, so treat the output geometry as something to inspect rather than trust.

Getting It Running: Plugin Manager, Dependencies, Model Download

Installation no longer involves manual downloads. Geo-SAM is on the QGIS Official Plugin Repository, so the path is Plugins > Manage and Install Plugins, search for Geo SAM, and click Install. The quick start then runs: open Geo-SAM Settings > Dependencies > Install Missing; restart QGIS; open Geo-SAM Settings > Model Management and download a model such as SAM2.1 Base; then click the Geo-SAM Segmentation icon, select an image layer and a model, and begin labelling. The dependency step installs into an isolated, plugin-private directory, which is a deliberate design choice: it avoids polluting the QGIS Python environment, and it also means a second copy of PyTorch lives on disk outside your usual site-packages. The Settings dialog consolidates Dependencies, Model Management, Cache and Help in one place, and the interface follows the QGIS locale setting across nine translated languages. Online XYZ and WMS tile layers are supported as segmentation sources, which is a meaningful addition for basemap-driven work.

Where Geo-SAM Is the Wrong Tool

The plugin is interactive by construction. Every mask originates from a prompt a human supplies, so throughput scales with clicks, not with compute. If your task is segmenting a hundred thousand tiles overnight, this is not the layer to build on; the geosam library underneath might be, but the QGIS plugin is a manual instrument. A second constraint is the feature cache. Live Encoding mode caches encoded features, and the Settings dialog exposes a Cache section, which implies cache growth is something the user is expected to manage. The README does not state a cache size limit or an eviction policy, so if you work across many large rasters in one session, watch that directory. Third, model download is a hard prerequisite: without weights in Model Management, the Segmentation tool has nothing to run. On an air-gapped or firewalled network, that step is where the workflow stops, and the material here does not describe an offline model import path.

How It Differs From Running SAM Through a Python Script

The obvious alternative is calling SAM or SAM 2 directly from Python, loading a raster with rasterio, feeding point prompts as arrays and writing polygons with geopandas or shapely. That route gives you scripting, batching, and full control over tiling and reprojection. What it does not give you is the QGIS canvas: no visual prompt placement on the actual layer, no style rendering of the resulting polygons, no direct write into a QGIS layer you can then edit. Geo-SAM's value is precisely that loop. The comparison in the project's own diagram makes the same point: the original SAM encodes prompts and image together, while Geo-SAM encodes image features in advance and queries prompts against saved features. If your prompts are already known coordinates, the script wins. If your prompts are decisions you make while looking at the imagery, the plugin wins.

Maintenance, Licensing and What the Release Cadence Suggests

Geo-SAM is MIT licensed, which permits commercial and closed-source use subject to the licence terms; the bundled SAM components carry their own terms from Meta and Ultralytics, and the repository acknowledges Segment Anything, SAM 2, Ultralytics, geosam and QGIS as upstream projects. That stacking matters if you redistribute the plugin or its dependencies, and it is worth reading each upstream licence rather than assuming MIT covers the whole stack. On cadence, v1.3.2 was tagged in May 2025 and v2.0 in June 2026, with the last push to the default branch in July 2026. The v2.0 notes describe a substantial rewrite (new core library, new model families, new dependency mechanism), which means upgrading from 1.3.x is not a drop-in patch. Users on v1.3.2 should expect to reinstall dependencies and re-download models after moving to v2.0, and the pre-encoded feature files produced by the old Image Encoder are a question the changelog would need to answer before you migrate a working project.

Editorial conclusion

Adopt Geo-SAM if you already work in QGIS and want SAM masks as editable vector polygons without leaving the canvas. Do not adopt it if you need automated, prompt-free segmentation across thousands of scenes, because every mask here starts from a human click. Before committing, verify that your raster is in a projected CRS at a resolution the downloaded checkpoint handles, and confirm the plugin-private dependency directory has enough disk space for the model weights you plan to download.

Official sources

  1. coolzhao/Geo-SAM on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Community notes

Community notes