Manual/Guides

AI Segmentation

Meratyn provides three segmentation workflows with different runtime requirements:

  • Processing → AI Segmentation sends text or automatic segmentation to a configured samgeo-api service.
  • Processing → Segment Everything runs SlimSAM locally in a browser worker.
  • Plugins → SamGeo connects to a configured samgeo-api service for text, point, box, and automatic prompts.

Processing → AI Segmentation

AI Segmentation accepts .tif, .tiff, .png, .jpg, and .jpeg images and supports text or automatic mode. It sends the request through Meratyn’s sidecar proxy to samgeo-api, reprojects the returned polygons to WGS84, adds them as a GeoJSON layer, and zooms to the result. The service defaults to SAM 3 and can expose other models through its model catalog.

Closing the panel cancels its active request. This workflow requires a reachable segmentation service; use Segment Everything when inference must remain local.

Processing → Segment Everything

Segment Everything finds distinct objects in a GeoTIFF and adds their outlines as a GeoJSON layer. Inference uses ONNX Runtime Web and a SlimSAM encoder and decoder; the image and model execution stay in the browser process. No Python sidecar is required.

The first run downloads the model files from the configured model host. Later runs reuse the cached bytes. A deployment that blocks external model downloads must host those files itself or disable this capability.

Using Segment Everything

  1. Open Processing → Segment Everything.
  2. Choose a .tif or .tiff image.
  3. Adjust the sampling grid, quality threshold, and minimum mask area when needed.
  4. Select Segment Everything. Meratyn reports model-download and inference progress, adds the resulting polygons as a layer, and zooms to them.

Closing the panel cancels the active inference run. No objects found is a normal result; lower the quality threshold, reduce the minimum size, or increase the sampling grid to search more densely.

Plugins → SamGeo

Activate Plugins → SamGeo for service-backed interactive segmentation. The panel accepts a loaded raster layer or an uploaded image and supports four modes:

  • Text prompt — send a natural-language prompt through SAM 3.
  • Foreground/background points — place positive and negative points on the map and refine the mask with SAM 3.
  • Bounding box — draw a box on the map and segment its contents with SAM 3.
  • Automatic (everything) — run the SAM 2 automatic mask generator. This mode exposes the SAM 2 model, points-per-side, predicted-IoU, and stability controls.

The panel also exposes the SAM 3 model ID, backend, confidence threshold, and minimum and maximum mask sizes. Results are reprojected to WGS84 and added as a new GeoJSON layer. Closing the panel or cancelling the run interrupts its owned request.

SamGeo is a build-only integration. Meratyn does not bundle model weights and does not grant or represent a model license. The operator supplies the weights, accepts the terms that apply to those weights, and configures the runtime on the service host. The browser stores only the non-secret service configuration; weights and backend caches stay in the service’s own storage boundary and are never serialized into a project file. The panel reports when weights are not bundled or configured so a missing runtime is explicit. Both MAPPVIEW_ML_SAMGEO_WEIGHTS_CONFIGURED=1 and MAPPVIEW_ML_SAMGEO_LICENSE_ACCEPTED=1 are required before the service is reported ready or an inference request can run.

SamGeo service setup

Install the lightweight sidecar proxy and the pinned model runtime separately. The base sidecar supports Python 3.10 or newer and its [ml] extra contains only the HTTP client. The operator-managed [samgeo-runtime] extra is a separate environment that requires Python 3.12 or newer and pins segment-geospatial[api,samgeo3]==1.4.2:

pip install -e ".[ml]"
pip install -e ".[samgeo-runtime]"
samgeo-api --port 8000

Run samgeo-api from the environment containing [samgeo-runtime], with a compatible PyTorch build. The runtime package and all model weights stay outside the desktop or browser bundle.

Point Meratyn at that service before launching it:

MAPPVIEW_ML_SAMGEO_URL=http://127.0.0.1:8000 mappview

Set the policy flags in the sidecar environment after supplying the weights and accepting their terms:

MAPPVIEW_ML_SAMGEO_WEIGHTS_CONFIGURED=1
MAPPVIEW_ML_SAMGEO_LICENSE_ACCEPTED=1

The desktop bundle does not include the model stack. Browser deployments must also expose a reachable service through the configured sidecar proxy.

Environment variablePurpose
MAPPVIEW_ML_SAMGEO_URLBase URL of a running samgeo-api; Meratyn proxies segmentation requests to it.
MAPPVIEW_ML_SAMGEO_CMDOptional command to launch samgeo-api from the operator runtime (default samgeo-api).
MAPPVIEW_ML_SAMGEO_WEIGHTS_CONFIGUREDSet to 1 only after operator-provided weights are configured; required for readiness.
MAPPVIEW_ML_SAMGEO_LICENSE_ACCEPTEDSet to 1 only after the operator accepts the supplied weights’ terms; required for readiness.
MAPPVIEW_ML_DEFAULT_MODELDefault service model version when the client does not choose one (default sam3).

The production browser suite verifies panel activation, request cancellation, cleanup, and result-layer lifecycle. Deployment teams must separately validate their selected model weights, GPU or CPU environment, and service endpoint.

See also Processing Tools.