Skip to main content

dearpygui-map

Map widget for Dear PyGui

Installation

Requirements

  • Python >= 3.10
  • Dear PyGui >= 1.3.1

Option 1 - pip

You can install this package from pip, with

pip install dearpygui-map

Option 2 - Local install from sources

Clone code repository from your local machine, install from there. Poetry is required.

git clone https://github.com/mkouhia/dearpygui-map.git
cd dearpygui-map
poetry build
# take note of the build step output, install package from the dist folder
pip install dist/PRODUCED_PACKAGE.whl

Usage

This basic example creates a map widget with defined size, initial center point (latitude, longitude) and initial zoom level. The zoom levels are same as on tiled maps, for example 12 could represent a town-sized view. Larger is more zoomed in.

import dearpygui.dearpygui as dpg
import dearpygui_map as dpg_map

dpg.create_context()

with dpg.window(label="Map demo"):
    dpg_map.add_map_widget(
        width=700,
        height=500,
        center=(60.1641, 24.9402),
        zoom_level=12)

dpg.create_viewport(title="Dear PyGui map widget demo", width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

The function add_map_widget places a Dear PyGui drawlist with map contents, return value is the drawlist tag.

By default, OpenStreetMap is used as the map tile source. This can be configured with add_map_widget argument tile_source, with similar source definition:

OpenStreetMap = TileServer(
    name="OpenStreetMap",
    base_url="http://{subdomain}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    subdomains=["a", "b", "c"],
    max_zoom_level=19,
    license_text="© OpenStreetMap contributors",
    thread_limit=2,
)

Technical details

Tiles are downloaded from the supplier on a background thread. Whenever map is zoomed or moved, more tiles are downloaded. The tiles are cached to local storage path in user cache directory - for different platforms, cache directories are:

Windows:    C:\Users\<username>\AppData\Local\dearpygui_map\Cache
Mac OS X:   ~/Library/Caches/dearpygui_map
Other:      ~/.cache/dearpygui_map

Known issues

As for now, dearpygui-map is in its early design phase and contains some items that may not be acceptable in production environments. These issues will be addressed later

  • Tile download threads are created every time TileManager.draw_layer is called.
  • Non-visible tiles are not removed from dearpygui
  • Zooming and panning leads to wait times before tiles are ready to be shown.

Development

Environment

Poetry is required for development (see installation instructions)

  1. Create development environment with poetry install
  2. Enter environment with poetry shell

Code quality and testing

All code is to be formatted with black:

black dearpygui_map

and code quality checked with pylint:

pylint dearpygui_map

Tests should be written in pytest, targeting maximum practical code coverage. Tests are run with:

pytest

and test coverage checked with

pytest --cov

Optionally, html test coverage reports can be produced with

pytest --cov dearpygui_map --cov-report html

Contributions

Contributions are welcome. Please also see GitHub issues and milestones.

Release files for dearpygui-map 0.1.1

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

Source distribution (sdist)

Source distribution for dearpygui-map 0.1.1
File Size Uploaded
dearpygui_map-0.1.1.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dearpygui-map 0.1.1
File Interpreter ABI Platform
dearpygui_map-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / dearpygui_map-0.1.1.tar.gz

Download URL dearpygui_map-0.1.1.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cf50bec0fefac33622589c00893405aebf6937255889e13875586edddda15dd1
BLAKE2b-256 checksum
How to use checksums
09c5aa2652f24d91fd89edd7b95e6de865ff24b5c0166fb11c1f1f45033ea384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.13.0-44-generic

Release files / dearpygui_map-0.1.1-py3-none-any.whl

Download URL dearpygui_map-0.1.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79760104326ba054f352e103ff06ddea513c65a0651dc33a6e983d28a60df1ac
BLAKE2b-256 checksum
How to use checksums
698c32a1f1fac0d519bd71cb981911b140822832491570e4fe8bd7705ed7eb8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.13.0-44-generic

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.1

2 release files

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