From c682bb934998476ca45118ab8acd417a738de7ec Mon Sep 17 00:00:00 2001 From: AlexanderJuestel Date: Sat, 20 Jul 2024 17:20:10 +0200 Subject: [PATCH] Fix #334 --- environment.yml | 12 ++++++------ environment_dev.yml | 6 +++--- gemgis/vector.py | 24 +++++++++++++++++++++++- requirements.txt | 8 ++++---- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/environment.yml b/environment.yml index 69f597fd..a58f9ddc 100644 --- a/environment.yml +++ b/environment.yml @@ -1,13 +1,13 @@ -# Requirements as of October 2023 +# Requirements as of July 2024 name: gemgis_env channels: - conda-forge dependencies: - - python>=3.10 - # geopandas will also install numpy, pandas, shapely, fiona, and pyproj - - geopandas>=0.14.0 + - python>=3.11 + # geopandas will also install numpy, pandas, shapely, pyogrio, and pyproj + - geopandas>=1.0.1 # rasterio will also install affine - - rasterio>=1.3.8 + - rasterio>=1.3.10 # pyvista also install pooch and matplotlib - - pyvista>=0.42.2 + - pyvista>=0.44.1 - gemgis>=1.1 diff --git a/environment_dev.yml b/environment_dev.yml index 11c6b989..c01a36dc 100644 --- a/environment_dev.yml +++ b/environment_dev.yml @@ -2,9 +2,9 @@ name: gemgis_dev_env channels: - conda-forge dependencies: - - python>=3.10 - # geopandas will also install numpy, pandas, shapely, fiona, and pyproj - - geopandas>=0.14.0 + - python>=3.11 + # geopandas will also install numpy, pandas, shapely, pyogrio, and pyproj + - geopandas>=1.0.1 # rasterio will also install affine #- rasterio>=1.3.8 will be installed through rioxarray # pyvista also install pooch and matplotlib diff --git a/gemgis/vector.py b/gemgis/vector.py index e421aec2..0f8105e6 100644 --- a/gemgis/vector.py +++ b/gemgis/vector.py @@ -28,7 +28,6 @@ import geopandas as gpd from gemgis.raster import sample_from_array, sample_from_rasterio from typing import Union, List, Tuple, Optional, Sequence, Collection -import fiona import pyvista as pv __all__ = [geometry] @@ -7194,6 +7193,13 @@ def load_gpx(path: str, """ + # Trying to import fiona but returning error if fiona is not installed + try: + import fiona + except ModuleNotFoundError: + raise ModuleNotFoundError( + 'fiona package is not installed. Use pip install fiona to install the latest version') + # Checking that the path is of type string if not isinstance(path, str): raise TypeError('The path must be provided as string') @@ -7275,6 +7281,13 @@ def load_gpx_as_dict(path: str, """ + # Trying to import fiona but returning error if fiona is not installed + try: + import fiona + except ModuleNotFoundError: + raise ModuleNotFoundError( + 'fiona package is not installed. Use pip install fiona to install the latest version') + # Checking that the path is of type string if not isinstance(path, str): raise TypeError('The path must be provided as string') @@ -7342,6 +7355,13 @@ def load_gpx_as_geometry(path: str, """ + # Trying to import fiona but returning error if fiona is not installed + try: + import fiona + except ModuleNotFoundError: + raise ModuleNotFoundError( + 'fiona package is not installed. Use pip install fiona to install the latest version') + # Checking that the path is of type string if not isinstance(path, str): raise TypeError('The path must be provided as string') @@ -7375,6 +7395,8 @@ def load_gpx_as_geometry(path: str, return shape +#def load_gpx_as_gdf(): + # Miscellaneous Functions ######################### diff --git a/requirements.txt b/requirements.txt index 2af1968c..03afcaf4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -# Requirements as of October 2023 +# Requirements as of July 2024 # geopandas will also install numpy, pandas, shapely, fiona, and pyproj -geopandas>=0.14.0 +geopandas>=1.0.1 # rasterio will also install affine -rasterio>=1.3.8 +rasterio>=1.3.10 # pyvista also install pooch and matplotlib -pyvista>=0.42.2 \ No newline at end of file +pyvista>=0.44.1 \ No newline at end of file