Expand description
A simple map view widget for egui.
This crate provides a Map widget that can be used to display a map from a tile server.
It supports panning, zooming, and displaying the current mouse position in geographical coordinates.
§Example
use eframe::egui;
use egui_map_view::{Map, config::OpenStreetMapConfig};
struct MyApp {
map: Map,
}
impl Default for MyApp {
fn default() -> Self {
Self {
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| {
if ui.add(&mut self.map).clicked() {
if let Some(pos) = self.map.mouse_pos {
println!("Map clicked at {} x {}", pos.lon, pos.lat);
}
};
});
}
}Modules§
- config
- Configuration traits and types for the map widget. Configuration for different map providers.
- layers
- Map layers. Layers for the map view that can handle input, and draw on top of the map view different kinds of data.
- projection
- Map projection. Projections handle converting different coordinate systems between other coordinate systems.
Structs§
Enums§
- MapError
- Errors that can occur while using the map widget.