Crate egui_map_view

Crate egui_map_view 

Source
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§

Map
The map widget.
TileId
A unique identifier for a map tile.

Enums§

MapError
Errors that can occur while using the map widget.

Constants§

MAX_ZOOM
The maximum zoom level.
MIN_ZOOM
The minimum zoom level.