Initial implementation of geo.py

This commit is contained in:
XANTRONIX 2025-03-20 00:17:04 -04:00
parent 1d6e2e88c0
commit 9f0d889972

15
lib/xmet/geo.py Normal file
View file

@ -0,0 +1,15 @@
import re
import shapely
def load_poly_from_file(path: str) -> shapely.Polygon:
points = list()
with open(path, 'r') as fh:
data = fh.read()
for line in data.split('\n'):
lat, lon = re.split(', ', line)
points.append((float(lon), float(lat)))
return shapely.Polygon(points)