- get_aoi_wkt(aoi_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], as_str: bool = True) Union[str, shapely.geometry.polygon.Polygon] [source]#
Get AOI formatted as a WKT from files that can be read by Fiona (like shapefiles, …) or directly from a WKT file. The use of KML has been forced (use it at your own risks !).
It is assessed that:
only one polygon composes the AOI (as only the first one is read)
it should be specified in lat/lon (WGS84) if a WKT file is provided
>>> path = "path/to/vec.geojson" # OK with ESRI Shapefile, geojson, WKT, KML... >>> get_aoi_wkt(path) 'POLYGON Z ((46.1947755465253067 32.4973553439109324 0.0000000000000000, 45.0353174370802520 32.4976496856158974 0.0000000000000000, 45.0355748149750283 34.1139970085580018 0.0000000000000000, 46.1956059695554089 34.1144793800670882 0.0000000000000000, 46.1947755465253067 32.4973553439109324 0.0000000000000000))'
AOI formatted as a WKT stored in lat/lon
- Return type