Repolode
opengeos

opengeos/segment-geospatial

A Python package that applies Meta's Segment Anything Model (SAM) to geospatial imagery such as satellite and aerial photos, producing georeferenced masks.

Stars
4,200
Forks
451
Open issues
8
Last commit
4 days ago

What is it?

SamGeo is a Python package that makes the Segment Anything Model usable on geospatial data with minimal code. It can download map tiles from Tile Map Service (TMS) servers and convert them to GeoTIFF files, then segment those rasters with SAM or HQ-SAM. Users can place foreground and background point prompts interactively, load prompts from vector files, or segment imagery with text prompts.

Results can be exported as GeoPackage, Shapefile, or GeoJSON, and prompts can be saved as GeoJSON. The package also supports segmenting timeseries remote sensing imagery and visualizing outputs on interactive maps. A REST API is available for serving segmentation over HTTP as an optional install.

SamGeo is also available as a QGIS plugin, and the project provides example notebooks for Jupyter, Google Colab, and ArcGIS Pro. It is installable from PyPI, conda-forge, or pixi, with separate optional extras for different SAM variants.

Key features

  • 01Downloads TMS map tiles and creates GeoTIFF files
  • 02Segments rasters with SAM and HQ-SAM
  • 03Supports text prompts for remote sensing imagery
  • 04Interactive foreground and background point markers
  • 05Exports results to GeoPackage, Shapefile, and GeoJSON
  • 06Provides a REST API for serving segmentation over HTTP

Use cases

  • Extracting buildings, pools, or other objects from satellite imagery
  • Batch segmenting timeseries remote sensing data to track land change
  • Creating vector masks for GIS workflows in QGIS or ArcGIS Pro
  • Running segmentation as a web service on a GPU server

Quick start

  1. 1

    Install segment-geospatial from PyPI with minimal dependencies

    pip install segment-geospatial

Things to know

  • A powerful GPU with at least 8 GB of GPU memory is recommended for large datasets.
  • Installing SAM 3 on Windows is tricky and needs extra steps.
  • Heavy dependencies such as PyTorch and CUDA make setup more involved.
  • Users who download many tiles from a basemap should get the provider's permission first.

In collections

Topics

FAQ

What is segment-geospatial?
A Python package that applies Meta's Segment Anything Model (SAM) to geospatial imagery such as satellite and aerial photos, producing georeferenced masks. SamGeo is a Python package that makes the Segment Anything Model usable on geospatial data with minimal code. It can download map tiles from Tile Map Service (TMS) servers and convert them to GeoTIFF files, then segment those rasters with SAM or HQ-SAM. Users can place foreground and background point prompts interactively, load prompts from vector files, or segment imagery with text prompts.
Is segment-geospatial free to use? What license does it have?
segment-geospatial is open source under the MIT license. Check the license terms before using it in commercial products.
Is segment-geospatial still maintained?
Actively maintained. The last commit to segment-geospatial was on Nov 3, 2026.
What can I use segment-geospatial for?
Extracting buildings, pools, or other objects from satellite imagery Batch segmenting timeseries remote sensing data to track land change Creating vector masks for GIS workflows in QGIS or ArcGIS Pro Running segmentation as a web service on a GPU server
How do I install segment-geospatial?
Install segment-geospatial from PyPI with minimal dependencies: pip install segment-geospatial
Where can I get segment-geospatial?
The source code and installation instructions are on GitHub: https://github.com/opengeos/segment-geospatial

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects