User Tools

Site Tools


samples:samples:aimodelrunner

Table of Contents

AIModelRunner sample

Documentation | Samples | AIModelRunner

Summary

How to run Python-driven AI models on TatukGIS Viewer snapshots and raster layers.

Description

This sample demonstrates how to execute AI inference models (like Real-ESRGAN or custom ONNX/PyTorch models via Python wrappers) directly from TatukGIS. It exports the map state, executes a Python script, parses a JSON manifest, and maps the output (raster layers or vector detections) back onto the map.

Check following guide: Running AI Models in Developer Kernel to learn how to run custom AI models in TatukGIS DK environment.

This sample illustrates use of:

Name Description
PythonWorkerDefaultGet or create the default singleton worker background worker that manages the TGIS_AIPythonManager internally (starts immediately).
TGIS_AIPythonWorker.EnqueueQueue a job (returns immediately).
TGIS_AIModelCustom.CreateInstantiates a custom AI model using a Python script and dependencies.
TGIS_AIModel.InstallModulesInstall Python modules required by the model.
TGIS_AIModel.RunRun the model for the provided image.
TGIS_AIModelOutput.GetDetectionsReturns bounding box or polygon detections.
TGIS_AIModelOutput.GetDetectionLayersReturns bounding box or polygon detections converted into vector layers.
TGIS_AIModelOutput.GetLayersReturns file-backed raster or vector layers generated by the model.
TGIS_ImageExporter.ExportToImageExport viewer content to an image file using TGIS_PixelExportManager.
TGIS_ImageExporter.GetPixelSizeCalculate how a single pixel translates to geographic distance from a source viewer, based on it's visible extent and viewer component size

Code

This sample is available on the following platforms (click to view the source code on GitHub):

2026/03/27 22:48

Page Tools