Implement line_heading()
This commit is contained in:
parent
e1adfd0059
commit
afad8898c7
1 changed files with 7 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import re
|
||||
import math
|
||||
import shapely
|
||||
|
||||
def load_poly_from_file(path: str) -> shapely.Polygon:
|
||||
|
@ -16,3 +17,9 @@ def load_poly_from_file(path: str) -> shapely.Polygon:
|
|||
points.append((float(lon), float(lat)))
|
||||
|
||||
return shapely.Polygon(points)
|
||||
|
||||
def line_heading(p1: shapely.Point, p2: shapely.Point) -> float:
|
||||
dx = p2.x - p1.x
|
||||
dy = p2.y - p1.y
|
||||
|
||||
return math.atan2(dy, dx)
|
||||
|
|
Loading…
Add table
Reference in a new issue