ENH: add Folium interactive flight trajectory map (#963) - #1132
Conversation
bf9ce35 to
2f52628
Compare
|
There are many other ways of implementing this one. We need first to reflect on that. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1132 +/- ##
===========================================
+ Coverage 91.41% 91.43% +0.01%
===========================================
Files 132 132
Lines 18133 18197 +64
===========================================
+ Hits 16577 16639 +62
- Misses 1556 1558 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Carries over the conventions from the team's internal rocketfolium module (EuRoC-Dev) into Flight.plots.trajectory_on_map, and fills the gaps that kept PR RocketPy-Team#1132 in draft. Map rendering: - Add OpenStreetMap and Esri World Imagery background layers behind a LayerControl. Satellite imagery is what actually answers the recovery question (terrain, tree lines, water), which plain OSM cannot show. - Mark the apogee ground position, labelled with apogee AGL, between the launch and landing markers. Skipped when apogee was never detected, since Flight.apogee_time then keeps its initial value of zero. - Add optional range safety circles around the launch pad, in their own feature group so the layer control can toggle them. The initial viewport widens to contain them, otherwise the largest ring would open off screen and the parameter would be useless. - Add an optional overlay title. The text is HTML-escaped before being injected into the map root. API: - Add time_step, for parity with Flight.export_kml: the ground track is resampled by linear interpolation instead of drawing every integration step, which keeps the HTML small for long flights. - Add color, so the track can be recoloured without post-processing. Docs: - Document the maps extra in installation.rst, next to the animation extra it mirrors. - Add an "Interactive Trajectory Map" section to the Flight user guide, with the parameter table and a cross-reference to export_kml for the 3D case that a 2D map cannot cover. Verified: 10/10 unit tests pass (including the real-folium HTML export), ruff clean, pylint 10.00/10, and sphinx-build -W builds with zero warnings. The rendered map was checked in a browser. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pad the fitted viewport by 30 px so the launch and landing pins, anchored at the very edge of the bounding box, are no longer clipped by the map border. Caught while rendering the screenshots below. Add two figures to the Flight user guide, captured from the real output: the ground track with the launch, apogee and landing markers over satellite imagery, and the safety_radii circles framed around the pad. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Hi @thatrandomasiandev — thanks for the patience on this one, and sorry for the long silence after my "there are many other ways of implementing this" comment. That was a vague thing to say without following up, so let me make it concrete. Back in #963 I mentioned we had internal tooling that already does Folium maps. That's a module we use to produce the impact maps for EuRoC, and rather than keep asking you to guess at our conventions, I've pushed the port directly onto your branch (fast-forward, nothing of yours rewritten). Please pull before you continue. What I changedYour structure was right — the optional-dependency handling, the
Launch (green), apogee ground position (blue), landing (red).
Other gaps closed
On the red
|


Summary
Flight.plots.trajectory_on_map()using optional Folium to render an interactive HTML map of the ground track with launch and landing markers.mapsoptional dependency extra (folium) and include it inrocketpy[all].Fixes #963
Test plan
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/unit/test_flight_trajectory_map.pyflight.plots.trajectory_on_map(filename="traj.html")opens in a browser with path + markers