Bring OsmAnd's native offline map stack into modern Qt6 and PySide6 apps β with native widgets,
.obfrendering, and cross-platform build tooling.
output.mp4
git lfs install
git lfs pullThe bundled World_basemap_2.obf demo map is stored through Git LFS. If the file is only about 100 bytes and starts with version https://git-lfs.github.com/spec/v1, it is still a pointer file and must be pulled with Git LFS before the preview can render real map data.
python -m pip install -e .powershell -ExecutionPolicy Bypass -File tools\osmand_render_helper_native\build_helper.ps1or build the native widget with MSVC:
powershell -ExecutionPolicy Bypass -File tools\osmand_render_helper_native\build_native_widget_msvc.ps1bash tools/osmand_render_helper_native/build_linux.shQT_ROOT=/opt/homebrew/opt/qt JOBS=4 bash tools/osmand_render_helper_native/build_macos.shosmand-preview --backend autoYou can also run the entry point directly:
python -m maps.main --backend autoPySide6-OsmAnd-SDK is an independent GitHub project for embedding OsmAnd's native map stack into modern Qt6 and PySide6 workflows.
It combines vendored OsmAnd core sources, native build tooling, Python integration, a Qt widget bridge, and a runnable preview application in one repository. The goal is to make offline map rendering easier to build, test, and embed from a single codebase.
Key highlights:
- π§ Ports the OsmAnd Qt5-era native map stack to Qt6.
- π§© Exposes a native C++ map widget for PySide6 applications.
- πΊοΈ Supports offline rendering from OsmAnd
.obfmap data. - β‘ Provides both native OpenGL preview and Python-driven raster preview paths.
- π Ships build scripts for Windows, Linux, and macOS toolchains.
- π¦ Bundles demo map data and OsmAnd resources for local testing.
This SDK is designed for developers who want OsmAnd's offline map engine while building with current-generation Qt and Python tooling. It reduces the friction of combining native C++ rendering with a PySide6 user interface, making it a practical foundation for desktop map viewers, GIS tools, travel applications, embedded map previews, and other offline-first location products.
By moving the native stack forward to Qt6 and validating PySide6 compatibility, the project helps OsmAnd-based development stay usable outside older Qt5-only integration paths.
| Capability | Description |
|---|---|
| Native widget hosting | Embed the OsmAnd native widget through PySide6 using .dll, .so, or .dylib runtimes. |
Offline .obf rendering |
Render OsmAnd binary map packages locally without depending on online map tiles. |
| Python raster path | Use helper-backed Python rendering for preview and integration workflows. |
| OpenGL preview | Test native OpenGL rendering paths through the included preview application. |
| Cross-platform builds | Build helper and widget outputs on Windows, Linux, and macOS. |
| Demo data included | Use the bundled World_basemap_2.obf and OsmAnd resources for local validation. |
| Path | Purpose |
|---|---|
vendor/osmand/build |
Build tree and supporting files used by the Windows-oriented OsmAnd build flow. |
vendor/osmand/core |
Vendored OsmAnd core sources. |
vendor/osmand/core-legacy |
Vendored legacy core sources still required by the native build. |
vendor/osmand/resources |
OsmAnd rendering resources, styles, and data files. |
tools/osmand_render_helper_native |
Native helper and widget sources plus Windows, Linux, and macOS build scripts. |
src/maps |
PySide6 preview application and Python integration layer. |
src/maps/main.py |
Preview entry point. |
OsmAnd .obf files are offline binary map packages. They store the geographic content consumed by the native engine, including roads, boundaries, land use, water, place labels, routing-related data, and points of interest.
This repository's preview defaults to:
src/maps/tiles/World_basemap_2.obf
The bundled .obf is only a default demo dataset. You can replace it with another OsmAnd .obf file, select a different file from the preview window, or point the runtime to a custom path through the documented environment variables.
Additional .obf map downloads are available from the official OsmAnd download list:
https://download.osmand.net/list.php
When a local plugin/data/geonames.sqlite3 GeoNames index is present, the preview search demo prefers it for place-name lookup and uses the active .obf search path as a fallback. The optimized database is compatible with the GeoNames-search project output, uses the compact cities500-based schema, and keeps global place-name queries such as εδΊ¬ / Beijing responsive without scanning the full database in Python.
Rendering styles are XML-based rule files under:
vendor/osmand/resources/rendering_styles
Common examples include:
default.render.xmlmapnik.render.xmlsnowmobile.render.xml
These files control how the same .obf data appears on screen: colors, line rules, polygon fills, icons, labels, and theme-specific display logic. The Python integration layer passes both the selected .obf data source and active style file into the OsmAnd rendering backend, allowing the map presentation to change without changing the underlying geographic data.
python -m pip install -e .
powershell -ExecutionPolicy Bypass -File tools\osmand_render_helper_native\build_helper.ps1
osmand-preview --backend autoAlternative native widget build:
powershell -ExecutionPolicy Bypass -File tools\osmand_render_helper_native\build_native_widget_msvc.ps1Direct entry point:
python src\maps\main.py --backend autoInstall system dependencies first:
# Ubuntu/Debian
sudo apt-get install build-essential cmake git qt6-base-dev libqt6opengl6-dev
# Fedora/RHEL
sudo dnf install gcc g++ cmake git qt6-qtbase-devel qt6-qtbase-gui qt6-qtdeclarative-devel
# Arch
sudo pacman -S base-devel cmake git qt6-baseThen build and run:
python -m pip install -e .
bash tools/osmand_render_helper_native/build_linux.sh
osmand-preview --backend autoDirect entry point:
python src/maps/main.py --backend autobrew install cmake qt git-lfs
git lfs install
git lfs pull
python -m pip install -e .
QT_ROOT=/opt/homebrew/opt/qt JOBS=4 bash tools/osmand_render_helper_native/build_macos.sh
osmand-preview --backend autoRun either backend explicitly:
python -m maps.main --backend python
python -m maps.main --backend native| Document | Description |
|---|---|
| Python SDK Guide | Python integration, runtime selection, preview usage, and embedding notes. |
| Python SDK Guide δΈζ | δΈζη Python SDK δ½Ώη¨ζεγ |
| Build Guide | Native helper/widget build process, platform toolchains, and runtime troubleshooting. |
| NOTICE | Licensing and third-party attribution context for vendored OsmAnd components. |
- The preview defaults to
src/maps/tiles/World_basemap_2.obfand the vendored resources undervendor/osmand/resources. - The bundled
.obfis a Git LFS file; rungit lfs pullafter cloning before expecting visible map content. - The bundled
.obfis replaceable, so you can test other OsmAnd map extracts. - Windows: helper outputs in
tools/osmand_render_helper_native/distandtools/osmand_render_helper_native/dist-msvcare generated and ignored by Git. - Linux: helper outputs in
tools/osmand_render_helper_native/dist-linuxare generated and ignored by Git. - macOS: helper outputs in
tools/osmand_render_helper_native/dist-macosxare generated and ignored by Git. - When the native widget runtime is available, the preview can use the embedded OsmAnd widget; otherwise the Python rendering path remains available.
- On Linux, the native widget library is built as a
.sofile; on macOS it is built asosmand_native_widget.dylib. - If you embed the native widget on Linux and hit XCB/GLX issues, see BUILD.md and the Python SDK Guide for Qt runtime flags that must be applied before
QApplicationstarts.
Because this repository redistributes vendored OsmAnd source trees, the top-level project is documented as GPL-3.0-or-later.
Top-level license files:
LICENSE: project-level license summary forPySide6-OsmAnd-SDKCOPYING: verbatim GNU GPL v3 text
Vendored upstream trees keep their own original license files:
vendor/osmand/core/LICENSEvendor/osmand/core-legacy/LICENSEvendor/osmand/resources/LICENSE
Additional context is summarized in NOTICE.md.
Created by OliverZhaohaibin.