import geopandas as gpd
from shapely.geometry import Polygon, MultiPolygon, shape, Point
import re
from shapely import wkb, wkt
import numpy as np
a_path = '/nas/k8s/dev/data/workspace-hkb/data_sample/KML/001_Market.kml'
b_path = '/nas/k8s/dev/data/workspace-hkb/data_sample/KML/000_Anloga Market.kml'
gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
df = gpd.read_file(b_path, driver='KML')
_drop_z = lambda geom: wkb.loads(wkb.dumps(geom, output_dimension=2))
df = df.geometry.transform(_drop_z)
polygon = df[0]
coords = np.dstack(polygon.boundary.xy).tolist()[0][:-1]
# print(coords)
lng_list = []
lat_list = []
for aoi_item in coords:
lng_list.append(aoi_item[0])
lat_list.append(aoi_item[1])
max_lng, min_lng = max(map(float, lng_list)), min(map(float, lng_list))
max_lat, min_lat = max(map(float, lat_list)), min(map(float, lat_list))
print(str(max_lng), str(min_lng), str(max_lat), str(min_lat))