Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map View and
GeoPoints
archetype (#6561)
### What Map Space View for GNSS/GPS data logged through new GPS Coordinates archetype. https://github.com/rerun-io/rerun/assets/82426/86b13ba3-97af-47d2-9422-7052d7064265 - Added a new `re_space_view_map` crate for visualizing `Points3D` with gps coordinates. - `map_visualizer_system.rs` implements the `VisualizerSystem` trait. It has only one meaningful function, that takes the `Positions3D` components and turns into `vec<MapEntry>` array along with optional `Color` and `Radius` components. This `vec<MapEntry>` is the only field of the `MapVisualizerSystem`. - `map_space_view.rs` is where the magic happens. It uses `walkers` slippy map implementation to show an OpenStreetMap or Mapbox map. On the `selection_ui ` you can change the map providers. To view Mapbox maps, you need to set mapbox tokens (you can get free tokens from Mapbox's site) and pass it via the env variable (`MAPBOX_ACCESS_TOKEN`) or via the blueprint - `map_windows.rs` is a small helper to show the zoom controls and acknowledgment on the UIs. - For blueprints I made `MapProvider` component (enum with providers+styles), and a `MapOptions` archetype. The logging of data is performed as follows: ```rust //! Log some GPS coordinates fn main() -> Result<(), Box<dyn std::error::Error>> { let rec = rerun::RecordingStreamBuilder::new("rerun_example_gps_coordinates").spawn()?; rec.log( "points", &rerun::Points3D::new([(47.6344, 19.1397, 0.0), (47.6344, 19.1399, 1.0)]), )?; Ok(()) } ``` The blueprint is defined as follows: ```python """Use a blueprint to show a map.""" import rerun as rr import rerun.blueprint as rrb rr.init("rerun_example_gps_coordinates", spawn=True) rr.log("points", Points3D([[47.6344, 19.1397, 0], [47.6334, 19.1399, 1]])) # Create a map view to display the chart. blueprint = rrb.Blueprint( rrb.MapView( origin="points", name="MapView", map_options=rrb.archetypes.MapOptions(provider=rrb.components.MapProvider.MapboxStreets), ), collapse_panels=True, ) rr.send_blueprint(blueprint) ``` The PR is not perfect, but the view is usable. Please review the changes and evaluate their potential utility for your needs. If you don't like, prefer not to merge just close it - no hard feelings. ### To be discussed * Check with you guys to see if the name is right at all. Maybe instead of GPS we can go with something better * Position3D is limited to `f32` instead of `f64`. This makes it less precise than `/NavSatFix` ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using my own lame demo app which is not part of the PR. * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/6561) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. --------- Co-authored-by: Antoine Beyeler <[email protected]>
- Loading branch information