egui-map-view
A simple, interactive map view widget for egui.

egui-map-view provides a pannable, zoomable map widget that fetches and displays tiles from a configurable tile server, making it easy to integrate interactive maps into your egui applications.
(Like it is the way of the times we live in Gemini codeassist LLM has been used in places to rework parts of the code and to bring more features to the codebase.)
Features
- Interactive Navigation: Pan by dragging, zoom with the mouse wheel or center and zoom with double-clicking.
- Asynchronous Tile Fetching: Tiles are downloaded in the background without blocking the UI, with support for
poll_promise. - Customizable Tile Providers: Use any tile server that follows the standard
z/x/yscheme. Comes with a pre-configured provider for OpenStreetMap and National Land Survey of Finland for which you need an API key to use. - Coordinate Display: Exposes the geographical coordinates (latitude, longitude) under the mouse cursor.
- Robust Placeholders: Displays placeholders for tiles that are loading or have failed to download, with error details available on hover.
- Attribution: Displays the map data's attribution with optional link to the provider's website.
- Robust layering system: Add layers to the map that can display additional data on top of the base map.
- Draw freehand information on top of the map with draw layer.
- Add text fields to the map with text layer.
- Add areas to the map with area layer.
- Display additional tiles on top of the base map with tile layer.
- GeoJSON Support: Serialize and deserialize layers (Area, Drawing, Text) to and from GeoJSON.
Usage
First, add egui-map-view to your Cargo.toml:
[]
= "0.3.1" # Replace with the latest version
Then, create a Map widget and add it to your egui UI.
use egui;
use ;
Configuration
The map's appearance and behavior are controlled by a type that implements the MapConfig trait. This trait defines the tile server URL, attribution, and default view settings.
egui-map comes with OpenStreetMapConfig for the standard OpenStreetMap tile server.
Using a Custom Tile Provider
You can implement the MapConfig trait to use any other tile server. For example, here's how you could create a configuration for a custom provider:
use MapConfig;
use TileId;
// Then, create the map with your custom provider.
let my_map = new;
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have any ideas for improvements.
Contributors
License
This project is licensed under the MIT License. See the LICENSE file for details.