Skip to main content

GeoKernel Python

Official Python package for the GeoKernel GIS SDK.

The package name is geokernel:

pip install geokernel

Install extended GDAL formats, DuckDB and GeoParquet support when needed:

pip install "geokernel[formats]"

all is the forward-compatible option for installing every optional GeoKernel runtime:

pip install "geokernel[all]"

Usage

import sys

from PySide6.QtWidgets import QApplication, QMainWindow

from geokernel import Viewer, ViewerTool

app = QApplication(sys.argv)

window = QMainWindow()
window.setWindowTitle("HelloMap")
window.resize(1200, 800)

viewer = Viewer(width=1200, height=800)
viewer.set_tool(ViewerTool.PAN)
viewer.add_layer(r"D:\data\world_4326.shp")

window.setCentralWidget(viewer.qt_widget())
window.closeEvent = lambda event: (viewer.close(), event.accept())

window.show()
app.processEvents()
viewer.show()
viewer.resize(window.centralWidget().width(), window.centralWidget().height())
viewer.full_extent()
viewer.refresh_layers()
app.exec()

Globe

The Globe API exposes all 56 native C ABI functions through Globe, typed request and result dataclasses, and the PySide6 GlobeWidget. The matching new native runtime is required: published SDK 1.5.34 predates this C API. These additions have not yet been published to PyPI.

from PySide6.QtWidgets import QApplication, QMainWindow
from geokernel import GlobeOptions, GlobeCamera
from geokernel.globe_qt import GlobeWidget

app = QApplication([])  # Create before the first Globe when using PySide6.
window = QMainWindow()
widget = GlobeWidget(
    options=GlobeOptions(network_enabled=True, atmosphere_enabled=True),
    camera=GlobeCamera(2.1744, 41.4036, 40, 2000, 50, 0),
)
window.setCentralWidget(widget)
window.resize(1100, 760)
window.show()
app.exec()

widget.globe provides camera/options, basemap discovery, layers, models, picking, measurement and terrain analysis. The ready, event_received and error signals report initialization, native notifications and pump failures. The widget pumps native work on its Qt timer. GlobeWidget is imported separately so importing geokernel does not load PySide6 or create a Qt application.

All calls, including close(), belong to the main thread. Use Globe as a context manager when managing a native parent or standalone window yourself; call process_events() to advance work and receive copied events. A native parent must outlive its Globe. There is no GC-thread finalizer. GlobeWidget releases its host on normal close, deleteLater, ancestor deletion, reparenting and application quit. For low-level shiboken6.delete, call close_globe() before deleting the parent. Reopening a closed widget creates a fresh session with its original settings.

from geokernel import GlobeVectorRequest, GlobeVectorStyle

job = widget.globe.load_vector(GlobeVectorRequest(
    "buildings", building_path,
    style=GlobeVectorStyle(category_field="type"),
))
# In event_received, on jobFinished, inspect get_job_state(job).
# completed/failed/cancelled records remain until forget_job(job).

wait_job(job, timeout=90) is available for blocking workflows and pumps Qt while waiting. Failed jobs raise GlobeJobError; cancelled jobs raise CancelledError. A timeout requests cancellation and raises TimeoutError; poll until terminal before forgetting that record. Failed/cancelled replacements keep the committed layer. Job completion means CPU publication; GPU/network activity may still be pending. Disposal cancels and joins work and can wait for provider I/O.

Use dataclasses.replace to update immutable options/camera values. Network access is fixed at creation. Defaults leave basemap, terrain, atmosphere and lighting off; choose a basemap from get_basemaps() and enable desired options explicitly. Screen queries and widget dimensions use logical Qt pixels. IDs/counters preserve all 64 bits. Dynamic layer settings/statistics and feature attributes are dictionaries. Native errors retain their numeric GlobeError.status and UTF-8 message.

Terrain results use resident, unexaggerated DEM data. Check available, status and stale: missing elevations remain None, and changing terrain invalidates results. Visibility is terrain-only; it excludes buildings, vegetation and refraction. Measurement distance/area use the native reference sphere. Viewshed cells are typed GlobeVisibilityCell values in west-east, north-south row order.

Globe verification

Run python -m unittest discover -s tests -p "test_globe_contract.py" -v for ABI/codec checks without native libraries. For real integration tests set GEOKERNEL_GLOBE_INTEGRATION=1, GEOKERNEL_BIN to the matching SDK bin directory, and GEOKERNEL_TEST_BUILDINGS, GEOKERNEL_TEST_MODEL, GEOKERNEL_TEST_RASTER, GEOKERNEL_TEST_DEM to the real Sagrada Familia files. On Windows, additional test-only DLL directories can be listed in GEOKERNEL_TEST_DLL_DIRS using ;. On Linux, configure LD_LIBRARY_PATH for the SDK/Qt dependencies and use X11/xcb (or Xvfb); foreign embedding on Wayland is unsupported by the native API.

Run python -m unittest discover -s tests -p "test_globe_*.py" -v. The Qt lifecycle test runs in an isolated process. No example smoke-test or command-line modes are introduced. Integration tests require a working Vulkan implementation.

Development

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .

Runtime Binaries

The PyPI package includes the universal, license-neutral GeoKernel runtime under:

src/geokernel/bin/

The runtime should include GeoKernel.Viewer.dll, GeoKernel DLLs, Qt DLLs, Skia/GDAL/PROJ dependencies, Qt plugins, GDAL plugins, gdal-data, and proj-data.

For development builds, copy the current local SDK runtime into the package with:

python tools\sync_runtime_binaries.py --source "D:\projects\GeoKernel\outputs\build\Release" --clean

If the package does not contain binaries yet, the wrapper also checks:

GEOKERNEL_BIN
D:\projects\GeoKernel\outputs\build\Release

Package Layout

src/
  geokernel/
    __init__.py
    geometry.py
    layer.py
    dll.py
    viewer.py
    bin/
tools/
  sync_runtime_binaries.py

Metadata

Release files for geokernel 1.5.37

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geokernel 1.5.37
File Size Uploaded Provenance Actions
geokernel-1.5.37.tar.gz 64.6 MB Without provenance Details for geokernel-1.5.37.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for geokernel 1.5.37
File Interpreter ABI Platform Actions
geokernel-1.5.37-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for geokernel-1.5.37-py3-none-win_amd64.whl
geokernel-1.5.37-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details for geokernel-1.5.37-py3-none-manylinux_2_35_x86_64.whl

Total release size: 184.5 MB

Release files / geokernel-1.5.37.tar.gz

Download URL geokernel-1.5.37.tar.gz
Size 64.6 MB
Tags Source
SHA-256 checksum
How to use checksums
573bc4818eae4accff5b98de745abdf93a4c5a636eefd4cf419b83f2efe6d6ad
BLAKE2b-256 checksum
How to use checksums
cbe5df5e327e1a45b5af9c32189b09395b953969b9cbaf73ad561c00e6baaf66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / geokernel-1.5.37-py3-none-win_amd64.whl

Download URL geokernel-1.5.37-py3-none-win_amd64.whl
Size 64.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
00dded6b5fb8be2201d42ba729caee4aae9a8a4e0de2d93c64ac49e5d142ff45
BLAKE2b-256 checksum
How to use checksums
66fc2ff749541f60b8edf6ad134f10f72c1a46635d0ade4d2ef11dc0e9a73150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / geokernel-1.5.37-py3-none-manylinux_2_35_x86_64.whl

Download URL geokernel-1.5.37-py3-none-manylinux_2_35_x86_64.whl
Size 55.2 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ffd721cdb2875cf55b2aa2ebc4dc9d32d9b7ddba5de66d691424d80dd535813f
BLAKE2b-256 checksum
How to use checksums
8a304d57f3ab4c0464e598f67f57d90e529dd12c4e2cfadb33fb07a6dd0e6907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for geokernel 1.5.37

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page