From 20cb0aad846cf13bed570a6125fdbabdef025540 Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:04:40 -0700 Subject: [PATCH 1/7] making gdal, matplotlib, seaborn as a optional package --- geo/Geoserver.py | 10 +++++++++- setup.py | 5 +---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/geo/Geoserver.py b/geo/Geoserver.py index f5abbd3..d62edbb 100644 --- a/geo/Geoserver.py +++ b/geo/Geoserver.py @@ -8,7 +8,6 @@ from xmltodict import parse, unparse # custom functions -from .Style import catagorize_xml, classified_xml, coverage_style_xml, outline_only_xml from .supports import prepare_zip_file, is_valid_xml, is_surrounded_by_quotes @@ -1612,6 +1611,7 @@ def create_coveragestyle( """ from .Calculation_gdal import raster_value + from .Style import coverage_style_xml raster = raster_value(raster_path) min_value = raster["min"] @@ -1708,6 +1708,9 @@ def create_catagorized_featurestyle( Inputs: column_name (based on which column style should be generated), workspace, color_or_ramp (color should be provided in hex code or the color ramp name, geom_type(point, line, polygon), outline_color(hex_color)) """ + + from .Style import catagorize_xml + catagorize_xml(column_name, column_distinct_values, color_ramp, geom_type) style_xml = "".format( @@ -1782,6 +1785,9 @@ def create_outline_featurestyle( The geometry type must be point, line or polygon Inputs: style_name (name of the style file in geoserver), workspace, color (style color) """ + + from .Style import outline_only_xml + outline_only_xml(color, width, geom_type) style_xml = "".format( @@ -1863,6 +1869,8 @@ def create_classified_featurestyle( Inputs: column_name (based on which column style should be generated), workspace, color_or_ramp (color should be provided in hex code or the color ramp name, geom_type(point, line, polygon), outline_color(hex_color)) """ + + from .Style import classified_xml classified_xml( style_name, column_name, diff --git a/setup.py b/setup.py index 60afdc3..8a7941d 100644 --- a/setup.py +++ b/setup.py @@ -47,11 +47,8 @@ install_requires=[ "pygments", "requests", - "seaborn", - "gdal", - "matplotlib", "xmltodict", ], - extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"]}, + extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"], 'visualize': ['matplotlib', 'seaborn', 'gdal']}, python_requires=">=3.6", ) From 803385344f0c82abdc235860fa320e7494d64325 Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:14:41 -0700 Subject: [PATCH 2/7] docs updated with warning --- docs/source/how_to_use.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/how_to_use.rst b/docs/source/how_to_use.rst index 768d046..bde1115 100644 --- a/docs/source/how_to_use.rst +++ b/docs/source/how_to_use.rst @@ -131,6 +131,9 @@ You can create a layer group from layers that have been uploaded previously with Uploading and publishing styles ------------------------------- +**WARNING:** As of version 2.9.0, the required dependency ``gdal``, ``matplotlib`` and ``seaborn`` was converted into an optional dependency. Fresh installations of this library will require that you then install ``gdal``, ``matplotlib`` and ``seaborn`` yourself with ``pip install gdal matplotlib seaborn``. + + It is used for uploading ``SLD`` files and publish style. If the style name already exists, you can pass the parameter ``overwrite=True`` to overwrite it. The name of the style will be name of the uploaded file name. Before uploading ``SLD`` file, please check the version of your sld file. By default the version of sld will be ``1.0.0``. As I noticed, by default the QGIS will provide the .sld file of version ``1.0.0`` for raster data version ``1.1.0`` for vector data. @@ -228,6 +231,8 @@ For generating the style for ``classified raster``, you can pass the another par Creating feature styles ----------------------- +**WARNING:** As of version 2.9.0, the required dependency ``gdal``, ``matplotlib`` and ``seaborn`` was converted into an optional dependency. Fresh installations of this library will require that you then install ``gdal``, ``matplotlib`` and ``seaborn`` yourself with ``pip install gdal matplotlib seaborn``. + It is used for creating the style for ``point``, ``line`` and ``polygon`` dynamically. It currently supports three different types of feature styles: 1. ``Outline featurestyle``: For creating the style which have only boundary color but not the fill style From 79d19b923896e947e302d7ce467633b6c67c02a2 Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:24:50 -0700 Subject: [PATCH 3/7] installation documentation --- docs/source/installation.rst | 26 +++++++++++++++++++------- setup.py | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index e1d0464..9168232 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -1,6 +1,10 @@ Installation ============= +.. warning:: + As of version 2.9.0, the required dependency ``gdal``, ``matplotlib`` and ``seaborn`` was converted into an optional dependency. Fresh installations of this library will require that you then install ``gdal``, ``matplotlib`` and ``seaborn`` yourself with ``pip install gdal matplotlib seaborn``. + + Conda installation ^^^^^^^^^^^^^^^^^^ @@ -8,17 +12,27 @@ The ``geoserver-rest`` can be installed from either ``conda-forge`` channel as b .. code-block:: shell - conda install -c conda-forge geoserver-rest + $ conda install -c conda-forge geoserver-rest Pip installation ^^^^^^^^^^^^^^^^ -For installation of this package, following packages should be installed first: +The ``geoserver-rest`` library can be installed using ``pip`` as below: + +.. code-block:: shell + + $ pip install geoserver-rest + + +If you want to install the geoserver-rest library with the optional dependencies, you need to install the following dependencies first: * `GDAL `_ +* `matplotlib `_ +* `seaborn `_ -Windows installation --------------------- + +Dependencies installation in Windows +------------------------------------ .. warning:: As of March 2022, ``pipwin`` has been deprecated and is no longer maintained. Do not use this method. @@ -31,14 +45,12 @@ One way is install the wheel directly from the `Geospatial library wheels for Py # For Python3.10 on Windows 64-bit systems $ pip.exe install https://github.com/cgohlke/geospatial-wheels/releases/download//GDAL-3.7.1-cp310-cp310-win_amd64.whl + $ pip.exe install seaborn matplotlib Another way is to use the GDAL network installer binary package available at: `OSGeo4W `_. -Now you can then install ``geoserver-rest`` library with ``pip``: -.. code-block:: shell - $ pip install geoserver-rest macOS installation ------------------ diff --git a/setup.py b/setup.py index 8a7941d..e39b850 100644 --- a/setup.py +++ b/setup.py @@ -49,6 +49,6 @@ "requests", "xmltodict", ], - extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"], 'visualize': ['matplotlib', 'seaborn', 'gdal']}, + extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"], 'style': ['matplotlib', 'seaborn', 'gdal']}, python_requires=">=3.6", ) From 2840b133a063963257e2737cdda0079f02eac07c Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:27:47 -0700 Subject: [PATCH 4/7] conda-install docs updated --- docs/source/installation.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 9168232..0b2ba9e 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -12,7 +12,7 @@ The ``geoserver-rest`` can be installed from either ``conda-forge`` channel as b .. code-block:: shell - $ conda install -c conda-forge geoserver-rest + $ conda install -c conda-forge geoserver-rest[all] Pip installation ^^^^^^^^^^^^^^^^ @@ -50,8 +50,6 @@ One way is install the wheel directly from the `Geospatial library wheels for Py Another way is to use the GDAL network installer binary package available at: `OSGeo4W `_. - - macOS installation ------------------ From 9d0d8177d676690c1c55ada1b2b7d43cf95c46b0 Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:46:55 -0700 Subject: [PATCH 5/7] optional dependencies requirement and docs update --- .gitignore | 1 + docs/source/installation.rst | 7 ++++++- geo/__init__.py | 2 +- requirements.txt | 2 -- setup.py | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b5a8fab..cb628a7 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,7 @@ target/ # Jupyter Notebook .ipynb_checkpoints +test.ipynb # IPython profile_default/ diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 0b2ba9e..247176a 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -23,8 +23,13 @@ The ``geoserver-rest`` library can be installed using ``pip`` as below: $ pip install geoserver-rest +But best way to get all the functationality is to install the optional dependencies as well: -If you want to install the geoserver-rest library with the optional dependencies, you need to install the following dependencies first: +.. code-block:: shell + + $ pip install geoserver-rest[all] + +If you want to install the geoserver-rest library with the optional dependencies (this will be useful if you are planning to create dynamic style files based on your dataset. Explore ``create_coveragestyle``, ``upload_style`` etc functions), you need to install the following dependencies first: * `GDAL `_ * `matplotlib `_ diff --git a/geo/__init__.py b/geo/__init__.py index a05ac77..8b13789 100644 --- a/geo/__init__.py +++ b/geo/__init__.py @@ -1 +1 @@ -from . import Calculation_gdal, Style + diff --git a/requirements.txt b/requirements.txt index dc0098d..3bc27ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ pygments requests -seaborn -matplotlib xmltodict \ No newline at end of file diff --git a/setup.py b/setup.py index e39b850..3be4ef8 100644 --- a/setup.py +++ b/setup.py @@ -49,6 +49,6 @@ "requests", "xmltodict", ], - extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"], 'style': ['matplotlib', 'seaborn', 'gdal']}, + extras_require={"dev": ["pytest", "black", "flake8", "sphinx>=1.7", "pre-commit"], 'style': ['matplotlib', 'seaborn', 'gdal'], 'all': ['matplotlib', 'seaborn', 'gdal']}, python_requires=">=3.6", ) From 5dde85ff616ca861c17066d8163a2503f7531d7a Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:47:01 -0700 Subject: [PATCH 6/7] optional dependencies requirement and docs update --- requirements_style.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements_style.txt diff --git a/requirements_style.txt b/requirements_style.txt new file mode 100644 index 0000000..6af2a8c --- /dev/null +++ b/requirements_style.txt @@ -0,0 +1,3 @@ +matplotlib +seaborn +gdal \ No newline at end of file From 61a9eba40b0225cf50e13e0fa866c9d58ef97de1 Mon Sep 17 00:00:00 2001 From: iamtekson Date: Thu, 23 Jan 2025 16:47:33 -0700 Subject: [PATCH 7/7] v2.9.1 --- geo/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geo/__version__.py b/geo/__version__.py index c82dfae..c6fb3a7 100644 --- a/geo/__version__.py +++ b/geo/__version__.py @@ -4,4 +4,4 @@ __author__ = "Tek Kshetri" __email__ = "iamtekson@gmail.com" -__version__ = "2.9.0" +__version__ = "2.9.1"