Flight Lines¶
A FlightLine is the fundamental unit of
data collection — a straight-and-level segment defined by two geographic
endpoints, an altitude, and metadata.
FlightLine class¶
- class FlightLine[source]¶
Bases:
objectRepresents a geospatial flight line with properties, validations, and operations.
A FlightLine is defined by two Waypoint objects (start and end). The Shapely LineString geometry and geodesic properties (length, azimuths) are derived from those waypoints.
Altitude is stored as MSL (above mean sea level), which is the standard aviation reference. Sensor calculations that depend on height above ground (AGL) must account for terrain elevation separately.
- property geometry: LineString¶
Shapely LineString derived from the two waypoints.
- property altitude_msl: Quantity¶
Flight altitude MSL (from waypoint1).
FlightLineis a single-altitude representation: both endpoints carry the same MSL altitude. This matches mission-design intent for survey lines flown at a chosen flight level, and the per-line residual against real sortie traces is small (≤2% on the validated NM17 B replay).For staged climbs during the takeoff phase (e.g., a heavy ER-2 levelling off briefly to burn fuel before continuing to climb) use
hyplan.aircraft.Aircraft.step_climb().
- classmethod start_length_azimuth(lat1, lon1, length, az, altitude_msl=None, site_name=None, site_description=None, investigator=None, **kwargs)[source]¶
Create a flight line from a start point, length, and azimuth.
- Parameters:
- Return type:
- Returns:
A new FlightLine extending from (lat1, lon1) along the given azimuth.
- classmethod from_endpoints(lat1, lon1, lat2, lon2, altitude_msl=None, site_name=None, site_description=None, investigator=None)[source]¶
Create a flight line from two endpoint coordinates.
- Parameters:
- Return type:
- Returns:
A new FlightLine from
(lat1, lon1)to(lat2, lon2).
- classmethod center_length_azimuth(lat, lon, length, az, altitude_msl=None, site_name=None, site_description=None, investigator=None, **kwargs)[source]¶
Create a flight line centered on a point, extending equally in both directions.
- Parameters:
- Return type:
- Returns:
A new FlightLine centered on (lat, lon) along the given azimuth.
- classmethod from_geojson(feature)[source]¶
Reconstruct a FlightLine from a GeoJSON Feature dict.
The feature must have a
LineStringgeometry with at least two coordinates. Propertiesaltitude_msl,site_name,site_description, andinvestigatorare read if present.- Parameters:
feature (
Dict) – GeoJSON Feature dict with LineString geometry.- Return type:
- Returns:
A new FlightLine.
- Raises:
HyPlanValueError – If the geometry is degenerate (start == end).
- clip_to_polygon(clip_polygon, merge_gap=<Quantity(10, 'nautical_mile')>)[source]¶
Clip the flight line to a specified polygon.
When clipping produces multiple segments (e.g. a coastline inlet splits the line), adjacent fragments separated by less than merge_gap are merged into a single continuous line. This prevents short gaps from fragmenting what should be a single pass — at typical survey speeds a 10 nm gap is under 3 minutes of flight.
- Parameters:
clip_polygon (Union[Polygon, MultiPolygon]) – The polygon to clip the flight line to.
merge_gap (
Union[Quantity,float,None]) – Maximum gap between adjacent fragments to merge. Accepts a pint Quantity or a plain float (assumed meters). Set toNoneor0to disable merging.
- Returns:
A list of resulting FlightLine(s), or None if no intersection exists.
- Return type:
Optional[List[“FlightLine”]]
- track(precision=100.0)[source]¶
Generate a LineString representing the flight line.
- Parameters:
precision (Union[Quantity, float]) – Desired distance between interpolated points. Accepts a Quantity with length units or a plain float (assumed meters).
- Returns:
A LineString object containing the interpolated track.
- Return type:
- reverse()[source]¶
Reverse the direction of the flight line.
- Returns:
A new FlightLine object with reversed direction.
- Return type:
- offset_north_east(offset_north, offset_east)[source]¶
Offset the flight line in the north and east directions.
- Parameters:
offset_north (Quantity) – Distance to offset in the north direction (positive or negative).
offset_east (Quantity) – Distance to offset in the east direction (positive or negative).
- Returns:
A new FlightLine object with the offset applied.
- Return type:
- offset_across(offset_distance)[source]¶
Offset the flight line perpendicular to its direction by a specified distance.
- Parameters:
offset_distance (Union[Quantity, float]) – Distance to offset the line (positive for right, negative for left). Plain floats are assumed meters.
- Returns:
A new FlightLine object with the offset applied.
- Return type:
- offset_along(offset_start, offset_end)[source]¶
Offset the flight line along its direction by modifying the start and end points.
- Parameters:
- Returns:
A new FlightLine object with the offset applied.
- Return type:
- rotate_around_midpoint(angle)[source]¶
Rotate the flight line around its midpoint by a specified angle.
- Parameters:
angle (float) – Rotation angle in degrees. Positive values indicate counterclockwise rotation.
- Returns:
A new FlightLine object rotated around its midpoint.
- Return type:
- split_by_length(max_length, gap_length=None)[source]¶
Split the flight line into segments of a specified maximum length with an optional gap between segments.
- Parameters:
max_length (Quantity) – Maximum length of each segment (meters).
gap_length (Optional[Quantity]) – Length of the gap between segments (meters). Default is None.
- Returns:
List of FlightLine objects representing the segments.
- Return type:
List[FlightLine]
Utilities¶
- to_gdf(flight_lines, crs='EPSG:4326')[source]¶
Convert a list of FlightLine objects to a GeoDataFrame.
- Parameters:
flight_lines (List[FlightLine]) – Flight lines to convert.
crs (str) – Coordinate reference system (default: “EPSG:4326”).
- Returns:
GeoDataFrame with flight line attributes and geometries.
- Return type:
gpd.GeoDataFrame