| Crates.io | egui-map-view |
| lib.rs | egui-map-view |
| version | 0.2.2 |
| created_at | 2025-09-01 07:18:25.201073+00 |
| updated_at | 2025-09-08 11:21:14.263028+00 |
| description | An slippy map viewer for egui applications. |
| homepage | https://github.com/braincow/egui-map-view |
| repository | https://github.com/braincow/egui-map-view |
| max_upload_size | |
| id | 1819231 |
| size | 3,736,030 |
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.)
poll_promise.z/x/y scheme. Comes with a pre-configured provider for OpenStreetMap and National Land Survey of Finland for which you need an API key to use.First, add egui-map-view to your Cargo.toml:
[dependencies]
egui-map-view = "0.2.1" # Replace with the latest version
Then, create a Map widget and add it to your egui UI.
use eframe::egui;
use egui_map::{Map, config::OpenStreetMapConfig};
struct MyApp {
map: Map,
}
impl Default for MyApp {
fn default() -> Self {
Self {
// Create a new map with the default OpenStreetMap provider.
map: Map::new(OpenStreetMapConfig::default()),
}
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default()
.frame(egui::Frame::NONE)
.show(ctx, |ui| {
// Add the map widget to the UI.
ui.add(&mut self.map);
});
// A window to show map information and controls.
egui::Window::new("Map Info").show(ctx, |ui| {
ui.label(format!("Zoom: {}", self.map.zoom));
ui.label(format!("Center: {:.4}, {:.4}", self.map.center.1, self.map.center.0));
ui.separator();
if let Some((lon, lat)) = self.map.mouse_pos {
ui.label(format!("Mouse: {:.4}, {:.4}", lat, lon));
} else {
ui.label("Mouse: N/A");
}
});
}
}
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.
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 egui_map::config::MapConfig;
use egui_map::TileId;
struct MyCustomProvider {
// ... any fields your provider needs, like an API key.
}
impl MapConfig for MyCustomProvider {
fn tile_url(&self, tile_id: &TileId) -> String {
// Construct the URL for your tile server.
format!("https://my-tile-server.com/{}/{}/{}.png", tile_id.z, tile_id.x, tile_id.y)
}
fn attribution(&self) -> &str {
// Return the attribution string required by your provider.
"My Custom Tiles © Me"
}
// You can also override default_center() and default_zoom().
}
// Then, create the map with your custom provider.
let my_map = Map::new(MyCustomProvider { /* ... */ });
Contributions are welcome! Feel free to open an issue or submit a pull request if you have any ideas for improvements.
This project is licensed under the MIT License. See the LICENSE file for details.