from importlib.metadata import PackageNotFoundError, version

from .geometry.crs import (
    create_transformer,
    degrees_to_km,
    detect_and_ensure_4326_geometry,
    detect_scheme_from_url,
    ensure_crs,
    km_to_degrees,
    num2deg,
    reproject_geojson,
)
from .geometry.merge_polygons import UndirectedGraph, merge_polygons
from .geometry.orthogonalize import orthogonalize_gdf, orthogonalize_polygon
from .geometry.tiles import (
    bbox2geom,
    check_geojson_geom,
    filter_tiles,
    get_tiles,
    load_geojson,
    load_geometry,
    split_geojson_by_tiles,
)
from .geometry.validate import (
    filter_gdf_by_area,
    fix_geom,
    validate_polygon_geometries,
)
from .raster.burn import burn_labels
from .raster.georeference import georeference_prediction_tiles, georeference_tile
from .raster.merge import merge_rasters
from .raster.morphology import (
    clear_border,
    extract_contours,
    morphological_cleaning,
    morphological_opening,
)
from .raster.patch import create_patches
from .raster.vectorize import vectorize_mask, vectorize_raster
from .training.prepare import prepare_dataset

try:
    __version__ = version("geomltoolkits")
except PackageNotFoundError:
    __version__ = "0.0.0"

__all__ = [
    "UndirectedGraph",
    "__version__",
    "bbox2geom",
    "burn_labels",
    "check_geojson_geom",
    "clear_border",
    "create_patches",
    "create_transformer",
    "degrees_to_km",
    "detect_and_ensure_4326_geometry",
    "detect_scheme_from_url",
    "ensure_crs",
    "extract_contours",
    "filter_gdf_by_area",
    "filter_tiles",
    "fix_geom",
    "georeference_prediction_tiles",
    "georeference_tile",
    "get_tiles",
    "km_to_degrees",
    "load_geojson",
    "load_geometry",
    "merge_polygons",
    "merge_rasters",
    "morphological_cleaning",
    "morphological_opening",
    "num2deg",
    "orthogonalize_gdf",
    "orthogonalize_polygon",
    "prepare_dataset",
    "reproject_geojson",
    "split_geojson_by_tiles",
    "validate_polygon_geometries",
    "vectorize_mask",
    "vectorize_raster",
]
