diff --git a/.gitignore b/.gitignore index 989b4ec..ca11776 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ __pycache__ -.vscode \ No newline at end of file +.vscode + +*.tif +*.geojson \ No newline at end of file diff --git a/README.md b/README.md index f502160..53aef08 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,46 @@ poetry shell ## Install the dependencies ```sh poetry install +``` +## Usage + +### Python APIs + +```python + +#Python API to access resources + +from pyGDI import createAuth +from pyGDI import ResourceFetchcer + +client_id="your client id" +client_secret="your client secret" +role="consumer" + +#authenticate first +auth= createAuth(client_id=client_id, client_secret=client_secret, role=role) + +resource_id="413872b1-84f3-4ca8-ad07-05c6cbb3ecf5" #sample is given +fetch_resource_data(auth= auth, resource_id=resource_id, save_object=True, config_path=None, file_path="download.geojson") + +``` + +```python + +#Python API to access STAC items + +from pyGDI import createSTACAuth +from pyGDI import get_assets + +client_id="your client id" +client_secret="your client secret" +role="consumer" +collection_ids="f6443e79-0594-4d65-bb0d-d025893c99fe" + +#authenticate first +stac_auth= createSTACAuth(client_id=client_id, client_secret=client_secret, role=role, collection_id=collection_ids) +get_assets(auth=stac_auth, config="config.json") + ``` ## Fetching Resources (Vector Resources) diff --git a/features/vector_features/get_re.py b/features/vector_features/get_re.py deleted file mode 100644 index 04d9e1c..0000000 --- a/features/vector_features/get_re.py +++ /dev/null @@ -1,96 +0,0 @@ -import requests -from auth.token_gen import TokenGenerator -from common.minio_ops import connect_store_minio -from common.paginator import fetch_paginated_data -import geopandas as gpd -import uuid -import io - - -class ResourceFetcher: - def __init__(self, client_id: str, client_secret: str, role: str): - - self.client_id = client_id - self.client_secret = client_secret - self.role = role - - - def fetch_resource_data(self, resource_id:str ,save_object : bool = False, config_path:str = None ,file_path : str = None ) -> dict: - """ - Function to fetch the resource data from the collections API using the resource_id. - Parameters - ---------- - client_id : str (Node red will translate it as input) - client_secret : str (Node red will translate it as input) - role : str (Node red will translate it as input) - resource_id : str (Node red will translate it as input) - save_object : enum [True, False] (Node red will translate it as input) - config_path : str (Node red will translate it as input) - file_path : str (Node red will translate it as input) - """ - - - - - try: - # Generate the token - token_generator = TokenGenerator(self.client_id, self.client_secret,self.role) - auth_token = token_generator.generate_token() - - # Request the collections API to get asset links - resource_url = f"https://geoserver.dx.geospatial.org.in/collections/{resource_id}" - headers = {"Authorization": f"Bearer {auth_token}"} - response = requests.get(resource_url, headers=headers) - response.raise_for_status() # Raise an HTTPError for bad responses - - links = response.json().get("links") - - # getting the rel:enclosure link to get all the data in single shot - enclosure_link_arr = [link["href"] for link in links if link.get("rel") == "enclosure"] - resource_url = enclosure_link_arr[0] if enclosure_link_arr else None - - # iterative pagination incase if there is no rel:enclosure link - if resource_url is None: - for link in links: - if link.get("rel") == "items": - data = fetch_paginated_data(link["href"], headers) - else: - response = requests.get(resource_url, headers=headers) - response.raise_for_status() - data = response.content - - - - gdf = gpd.read_file(io.BytesIO(data))# Read the fetched data as a geopandas dataframe - - if save_object: - if not file_path: - file_path = f"{uuid.uuid4()}.pkl" - try: - gdf.to_file(file_path, driver='GeoJSON') - # connect_store_minio(config_path, self.client_id, gdf, file_path) - except Exception as e: - raise Exception(f"Error while saving file: {e}") - else: - print("Data not saved. Set save_object to True , provide the minio config path and file_path to save the data to minio.") - print(gdf.info()) - - return gdf # Return the fetched data as a geopandas dataframe - except requests.RequestException as e: - raise Exception(f"Error fetching resource data: {e}") - - - -# client-id 7dcf1193-4237-48a7-a5f2-4b530b69b1cb --client-secret a863cafce5bd3d1bd302ab079242790d18cec974 --role consumer --resource-id 024b0c51-e44d-424c-926e-254b6c966978 -# client_id = '7dcf1193-4237-48a7-a5f2-4b530b69b1cb' -# client_secret = "a863cafce5bd3d1bd302ab079242790d18cec974" -# role = "consumer" -# resource_id = "024b0c51-e44d-424c-926e-254b6c966978" -# save_object = False -# config_path = "../config.json" -# file_path = "intermediate/data_new3.pkl" -# fetcher = ResourceFetcher(client_id, client_secret, role) -# resource_data = fetcher.fetch_resource_data(resource_id, save_object, config_path, file_path) - - - diff --git a/gdi_cli.py b/gdi_cli.py index 8f8e5a2..f896351 100644 --- a/gdi_cli.py +++ b/gdi_cli.py @@ -1,28 +1,22 @@ import click -from auth.token_gen import TokenGenerator - -from features.vector_features.get_re import ResourceFetcher -from features.vector_features.count_features import count_features -from features.vector_features.download_features import download_features -from features.vector_features.buffer import make_buffer -from features.vector_features.intersection import make_intersection -from features.vector_features.gcode import list_features -from features.vector_features.compute_geo import compute_geometry_measures -from features.vector_features.ReduceToImage import reduce_to_image -from features.vector_features.optimalRoute import compute_optimal_route -from features.vector_features.voronoi_diagram import create_voronoi_diagram -from features.vector_features.clip_data import make_clip -from features.vector_features.delaunay_triangles import make_delaunay_triangles - -from features.raster_features.search_cat import search_stac -from features.raster_features.get_data import get_assets - -from common.minio_ops import get_ls - -def gen_token(client_id, client_secret, role): - token_generator = TokenGenerator(client_id, client_secret, role) - auth_token = token_generator.generate_token() - return auth_token +from pyGDI import createAuth, createSTACAuth +from pyGDI import fetch_resource_data +from pyGDI import count_features +from pyGDI import download_features +from pyGDI import make_buffer +from pyGDI import make_intersection +from pyGDI import list_features +from pyGDI import compute_geometry_measures +from pyGDI import reduce_to_image +from pyGDI import compute_optimal_route +from pyGDI import create_voronoi_diagram +from pyGDI import make_clip +from pyGDI import make_delaunay_triangles + +from pyGDI import search_stac +from pyGDI import get_assets + +from pyGDI import get_ls def get_resource(client_id, client_secret, role, resource_id, save_object, config_path, file_path): @@ -40,8 +34,8 @@ def get_resource(client_id, client_secret, role, resource_id, save_object, confi file_path : str (Node red will ignore this parameter) """ - fetcher = ResourceFetcher(client_id, client_secret, role) - resource_data = fetcher.fetch_resource_data(resource_id, save_object, config_path, file_path) + auth = createAuth(client_id=client_id, client_secret=client_secret, role=role) + resource_data = fetch_resource_data(auth,resource_id, save_object, config_path, file_path) return resource_data @@ -53,7 +47,7 @@ def get_resource(client_id, client_secret, role, resource_id, save_object, confi @click.option('--role', required=True, help="Role for the token.", default = "consumer") def generate_token(client_id, client_secret, role): """Generate an authentication token.""" - token = gen_token(client_id, client_secret, role) + token = createAuth(client_id, client_secret, role) click.echo(f"Generated Token: {token}") @@ -238,7 +232,8 @@ def search_cat(collection_ids): @click.option('--config', required=True, help="Path to the config file.") def get_stac_assets(client_id, client_secret, role, collection_ids, config): '''Download Cartosat images from the STAC browser and stream to minio''' - get_assets(client_id, client_secret, role, collection_ids, config) + stac_auth=createSTACAuth(client_id, client_secret, role, collection_ids) + get_assets(stac_auth,config) diff --git a/pyGDI/__init__.py b/pyGDI/__init__.py new file mode 100644 index 0000000..11566f1 --- /dev/null +++ b/pyGDI/__init__.py @@ -0,0 +1,21 @@ +from .auth.token_gen import TokenGenerator, createAuth +from .auth.stac_token_gen import StacTokenGenerator, createSTACAuth + +from .features.vector_features.get_re import fetch_resource_data +from .features.vector_features.count_features import count_features +from .features.vector_features.download_features import download_features +from .features.vector_features.buffer import make_buffer +from .features.vector_features.intersection import make_intersection +from .features.vector_features.gcode import list_features +from .features.vector_features.compute_geo import compute_geometry_measures +from .features.vector_features.ReduceToImage import reduce_to_image +from .features.vector_features.optimalRoute import compute_optimal_route +from .features.vector_features.voronoi_diagram import create_voronoi_diagram +from .features.vector_features.clip_data import make_clip +from .features.vector_features.delaunay_triangles import make_delaunay_triangles + +from .features.raster_features.search_cat import search_stac +from .features.raster_features.get_data import get_assets + +from .common.minio_ops import get_ls + diff --git a/auth/stac_token_gen.py b/pyGDI/auth/stac_token_gen.py similarity index 62% rename from auth/stac_token_gen.py rename to pyGDI/auth/stac_token_gen.py index 17e005f..ceabee3 100644 --- a/auth/stac_token_gen.py +++ b/pyGDI/auth/stac_token_gen.py @@ -13,15 +13,32 @@ class StacTokenGenerator: role (str): The role for the request payload. """ - def __init__(self, client_id: str, client_secret: str, role: str, collection_id:list): - self.client_id = client_id - self.client_secret = client_secret - self.token_url = "https://dx.geospatial.org.in/auth/v1/token" - self.item_id = collection_id - self.item_type = "resource" - self.role = role + def __init__(self, client_id: str, client_secret: str, role: str, collection_id:str): + self._client_id = client_id + self._client_secret = client_secret + self._token_url = "https://dx.geospatial.org.in/auth/v1/token" + self._item_id = collection_id + self._item_type = "resource" + self._role = role - def generate_token(self) -> str: + @property + def client_id(self) -> str: + return self._client_id + + @property + def client_secret(self) -> str: + return self._client_secret + + @property + def role(self): + return self._role + + @property + def collection_id(self): + return self._item_id + + @property + def get_stac_token(self) -> str: """ Generate an authentication token. @@ -30,16 +47,16 @@ def generate_token(self) -> str: """ try: response = requests.post( - self.token_url, + self._token_url, headers={ - "clientId": self.client_id, - "clientSecret": self.client_secret, + "clientId": self._client_id, + "clientSecret": self._client_secret, "Content-Type": "application/json" }, json={ - "itemId": self.item_id, - "itemType": self.item_type, - "role": self.role + "itemId": self._item_id, + "itemType": self._item_type, + "role": self._role } ) @@ -54,6 +71,13 @@ def generate_token(self) -> str: except requests.RequestException as e: # print(response.json()) raise Exception(f"Error generating auth token: {e}") + + +def createSTACAuth(client_id: str, client_secret: str, role: str, collection_id:str) -> StacTokenGenerator: + + tokengenerator= StacTokenGenerator(client_id=client_id, client_secret=client_secret, role=role, collection_id=collection_id) + return tokengenerator + # Example usage diff --git a/auth/token_gen.py b/pyGDI/auth/token_gen.py similarity index 63% rename from auth/token_gen.py rename to pyGDI/auth/token_gen.py index ffe86b4..9b1c21d 100644 --- a/auth/token_gen.py +++ b/pyGDI/auth/token_gen.py @@ -14,14 +14,28 @@ class TokenGenerator: """ def __init__(self, client_id: str, client_secret: str, role: str): - self.client_id = client_id - self.client_secret = client_secret - self.token_url = "https://dx.geospatial.org.in/auth/v1/token" - self.item_id = "geoserver.dx.geospatial.org.in" - self.item_type = "resource_server" - self.role = role + self._client_id = client_id + self._client_secret = client_secret + self._token_url = "https://dx.geospatial.org.in/auth/v1/token" + self._item_id = "geoserver.dx.geospatial.org.in" + self._item_type = "resource_server" + self._role = role - def generate_token(self) -> str: + @property + def client_id(self) -> str: + return self._client_id + + @property + def client_secret(self) -> str: + return self._client_secret + + @property + def role(self): + return self._role + + + @property + def get_token(self) -> str: """ Generate an authentication token. @@ -30,16 +44,16 @@ def generate_token(self) -> str: """ try: response = requests.post( - self.token_url, + self._token_url, headers={ - "clientId": self.client_id, - "clientSecret": self.client_secret, + "clientId": self._client_id, + "clientSecret": self._client_secret, "Content-Type": "application/json" }, json={ - "itemId": self.item_id, - "itemType": self.item_type, - "role": self.role + "itemId": self._item_id, + "itemType": self._item_type, + "role": self._role } ) @@ -54,6 +68,12 @@ def generate_token(self) -> str: raise Exception(f"Error generating auth token: {e}") +def createAuth(client_id: str, client_secret: str, role: str) -> TokenGenerator: + + tokengenerator= TokenGenerator(client_id=client_id, client_secret=client_secret, role=role) + return tokengenerator + + # Example usage # if __name__ == "__main__": # client_id = "7dcf1193-4237-48a7-a5f2-4b530b69b1cb" diff --git a/common/minio_ops.py b/pyGDI/common/minio_ops.py similarity index 100% rename from common/minio_ops.py rename to pyGDI/common/minio_ops.py diff --git a/common/paginator.py b/pyGDI/common/paginator.py similarity index 100% rename from common/paginator.py rename to pyGDI/common/paginator.py diff --git a/features/raster_features/convert_to_cog.py b/pyGDI/features/raster_features/convert_to_cog.py similarity index 100% rename from features/raster_features/convert_to_cog.py rename to pyGDI/features/raster_features/convert_to_cog.py diff --git a/features/raster_features/get_data.py b/pyGDI/features/raster_features/get_data.py similarity index 68% rename from features/raster_features/get_data.py rename to pyGDI/features/raster_features/get_data.py index a583ef0..a4df5f4 100644 --- a/features/raster_features/get_data.py +++ b/pyGDI/features/raster_features/get_data.py @@ -2,32 +2,30 @@ from pystac_client import Client, ItemSearch import warnings from .search_cat import search_get_stac -from auth.stac_token_gen import StacTokenGenerator +from pyGDI.auth.stac_token_gen import StacTokenGenerator warnings.filterwarnings("ignore") import os import io from tqdm import tqdm -from common.minio_ops import connect_minio,stream_to_minio -from features.raster_features.convert_to_cog import tiff_to_cogtiff +from pyGDI.common.minio_ops import connect_minio,stream_to_minio +from pyGDI.features.raster_features.convert_to_cog import tiff_to_cogtiff - -def get_assets(client_id: str, client_secret: str, role: str, collection_ids: str, config: str) -> None: +def get_assets(auth:StacTokenGenerator, config: str) -> None: ''' Download Cartosat images from the STAC browser and stream to MinIO with band-based naming. - - Parameters - --------------- - client_id: str (client_id, same as the bucket name) - client_secret: str (client_secret for authentication) - role: str (role for the token) - collection_ids: str (collection_ids for the STAC browser) - config: str (path to the MinIO config file) + + Args: + auth (StacTokenGenerator): auth object for STAC + config (str): path to the MinIO config file + + Returns: + None ''' - links_dict = search_get_stac([collection_ids]) - token_generator = StacTokenGenerator(client_id, client_secret, role, collection_ids) - auth_token = token_generator.generate_token() + + links_dict = search_get_stac([auth.collection_id]) + auth_token = auth.get_stac_token headers = {"Authorization": f"Bearer {auth_token}"} - client = connect_minio(config, client_id) + client = connect_minio(config, auth.client_id) try: for folder_name, assets in links_dict.items(): @@ -51,9 +49,9 @@ def get_assets(client_id: str, client_secret: str, role: str, collection_ids: st # Convert the tiff files cog_tif = tiff_to_cogtiff(temp_tif, temp_cogtif) - + #upload to minio - stream_to_minio(client, client_id, filename, cog_tif) + stream_to_minio(client, auth.client_id, filename, cog_tif) #remove temp files os.remove(temp_tif) diff --git a/features/raster_features/make_cog_tif.py b/pyGDI/features/raster_features/make_cog_tif.py similarity index 100% rename from features/raster_features/make_cog_tif.py rename to pyGDI/features/raster_features/make_cog_tif.py diff --git a/features/raster_features/search_cat.py b/pyGDI/features/raster_features/search_cat.py similarity index 100% rename from features/raster_features/search_cat.py rename to pyGDI/features/raster_features/search_cat.py diff --git a/features/vector_features/ReduceToImage.py b/pyGDI/features/vector_features/ReduceToImage.py similarity index 99% rename from features/vector_features/ReduceToImage.py rename to pyGDI/features/vector_features/ReduceToImage.py index d4cc0ae..bc9eb22 100644 --- a/features/vector_features/ReduceToImage.py +++ b/pyGDI/features/vector_features/ReduceToImage.py @@ -4,7 +4,7 @@ from rasterio.transform import from_origin from rasterio.enums import Resampling from shapely.geometry import box -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import pickle as pkl import os import uuid diff --git a/features/vector_features/buffer.py b/pyGDI/features/vector_features/buffer.py similarity index 97% rename from features/vector_features/buffer.py rename to pyGDI/features/vector_features/buffer.py index cb6700b..e793a12 100644 --- a/features/vector_features/buffer.py +++ b/pyGDI/features/vector_features/buffer.py @@ -1,5 +1,5 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import warnings warnings.filterwarnings("ignore") diff --git a/features/vector_features/clip_data.py b/pyGDI/features/vector_features/clip_data.py similarity index 98% rename from features/vector_features/clip_data.py rename to pyGDI/features/vector_features/clip_data.py index 05d2e57..c34d185 100644 --- a/features/vector_features/clip_data.py +++ b/pyGDI/features/vector_features/clip_data.py @@ -2,7 +2,7 @@ import uuid import pickle import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio def make_clip( config: str, diff --git a/features/vector_features/compute_geo.py b/pyGDI/features/vector_features/compute_geo.py similarity index 98% rename from features/vector_features/compute_geo.py rename to pyGDI/features/vector_features/compute_geo.py index 4c0bb1f..aaacb42 100644 --- a/features/vector_features/compute_geo.py +++ b/pyGDI/features/vector_features/compute_geo.py @@ -1,5 +1,5 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import pickle as pkl import os import uuid diff --git a/features/vector_features/count_features.py b/pyGDI/features/vector_features/count_features.py similarity index 94% rename from features/vector_features/count_features.py rename to pyGDI/features/vector_features/count_features.py index edd9bf7..c0915c5 100644 --- a/features/vector_features/count_features.py +++ b/pyGDI/features/vector_features/count_features.py @@ -1,5 +1,5 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import warnings warnings.filterwarnings("ignore") import pickle as pkl diff --git a/features/vector_features/delaunay_triangles.py b/pyGDI/features/vector_features/delaunay_triangles.py similarity index 98% rename from features/vector_features/delaunay_triangles.py rename to pyGDI/features/vector_features/delaunay_triangles.py index baf35fb..6769b7e 100644 --- a/features/vector_features/delaunay_triangles.py +++ b/pyGDI/features/vector_features/delaunay_triangles.py @@ -6,7 +6,7 @@ import geopandas as gpd from shapely.geometry import Point, Polygon from scipy.spatial import Delaunay -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio if "numpy._core.numeric" not in sys.modules: try: diff --git a/features/vector_features/download_features.py b/pyGDI/features/vector_features/download_features.py similarity index 96% rename from features/vector_features/download_features.py rename to pyGDI/features/vector_features/download_features.py index 810093b..506de0d 100644 --- a/features/vector_features/download_features.py +++ b/pyGDI/features/vector_features/download_features.py @@ -1,11 +1,12 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import warnings warnings.filterwarnings("ignore") import pickle as pkl import os from datetime import timedelta import uuid + def download_features(config : str, client_id : str, artefact_url : str, save_as : str) -> str: """ Download features from the minio bucket and save it as a geopackage file. diff --git a/features/vector_features/gcode.py b/pyGDI/features/vector_features/gcode.py similarity index 100% rename from features/vector_features/gcode.py rename to pyGDI/features/vector_features/gcode.py diff --git a/pyGDI/features/vector_features/get_re.py b/pyGDI/features/vector_features/get_re.py new file mode 100644 index 0000000..f1c470c --- /dev/null +++ b/pyGDI/features/vector_features/get_re.py @@ -0,0 +1,88 @@ +import requests +from pyGDI.auth.token_gen import TokenGenerator +from pyGDI.common.minio_ops import connect_store_minio +from pyGDI.common.paginator import fetch_paginated_data +import geopandas as gpd +import uuid +import io + + + + +def fetch_resource_data(auth:TokenGenerator,resource_id:str ,save_object : bool = False, config_path:str = None ,file_path : str = None ) -> gpd.GeoDataFrame: + """ + Function to fetch the resource data from the collections API using the resource_id. + Parameters + Args: + auth (TokenGenerator): auth object + resource_id (str): str Node red will translate it as input + save_object (bool) : enum [True, False] (Node red will translate it as input + config_path (str) : Node red will translate it as input + file_path (str): Node red will translate it as input + + Returns: + gpd.GeoDataFrame: Downloaded vector file in geodataframe + """ + + + try: + # Generate the token + auth_token = auth.get_token + + # Request the collections API to get asset links + resource_url = f"https://geoserver.dx.geospatial.org.in/collections/{resource_id}" + headers = {"Authorization": f"Bearer {auth_token}"} + response = requests.get(resource_url, headers=headers) + response.raise_for_status() # Raise an HTTPError for bad responses + + links = response.json().get("links") + + # getting the rel:enclosure link to get all the data in single shot + enclosure_link_arr = [link["href"] for link in links if link.get("rel") == "enclosure"] + resource_url = enclosure_link_arr[0] if enclosure_link_arr else None + + # iterative pagination incase if there is no rel:enclosure link + if resource_url is None: + for link in links: + if link.get("rel") == "items": + data = fetch_paginated_data(link["href"], headers) + else: + response = requests.get(resource_url, headers=headers) + response.raise_for_status() + data = response.content + + + + gdf = gpd.read_file(io.BytesIO(data))# Read the fetched data as a geopandas dataframe + + if save_object: + if not file_path: + file_path = f"{uuid.uuid4()}.pkl" + try: + gdf.to_file(file_path, driver='GeoJSON') + # connect_store_minio(config_path, self.client_id, gdf, file_path) + except Exception as e: + raise Exception(f"Error while saving file: {e}") + else: + print("Data not saved. Set save_object to True , provide the minio config path and file_path to save the data to minio.") + print(gdf.info()) + + return gdf # Return the fetched data as a geopandas dataframe + except requests.RequestException as e: + raise Exception(f"Error fetching resource data: {e}") + + + +# client-id 7dcf1193-4237-48a7-a5f2-4b530b69b1cb --client-secret a863cafce5bd3d1bd302ab079242790d18cec974 --role consumer --resource-id 024b0c51-e44d-424c-926e-254b6c966978 +# client_id = '7dcf1193-4237-48a7-a5f2-4b530b69b1cb' +# client_secret = "a863cafce5bd3d1bd302ab079242790d18cec974" +# role = "consumer" +# resource_id = "024b0c51-e44d-424c-926e-254b6c966978" +# save_object = False +# config_path = "../config.json" +# file_path = "intermediate/data_new3.pkl" +# fetcher = ResourceFetcher(client_id, client_secret, role) +# resource_data = fetcher.fetch_resource_data(resource_id, save_object, config_path, file_path) + + + diff --git a/features/vector_features/intersection.py b/pyGDI/features/vector_features/intersection.py similarity index 97% rename from features/vector_features/intersection.py rename to pyGDI/features/vector_features/intersection.py index 4738376..2c32139 100644 --- a/features/vector_features/intersection.py +++ b/pyGDI/features/vector_features/intersection.py @@ -1,6 +1,6 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import pickle as pkl import os import uuid diff --git a/features/vector_features/optimalRoute.py b/pyGDI/features/vector_features/optimalRoute.py similarity index 99% rename from features/vector_features/optimalRoute.py rename to pyGDI/features/vector_features/optimalRoute.py index 15a29b1..0025265 100644 --- a/features/vector_features/optimalRoute.py +++ b/pyGDI/features/vector_features/optimalRoute.py @@ -8,7 +8,7 @@ from networkx.algorithms.approximation import traveling_salesman_problem from tqdm import tqdm -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio def compute_optimal_route( diff --git a/features/vector_features/voronoi_diagram.py b/pyGDI/features/vector_features/voronoi_diagram.py similarity index 98% rename from features/vector_features/voronoi_diagram.py rename to pyGDI/features/vector_features/voronoi_diagram.py index 6659455..ef14200 100644 --- a/features/vector_features/voronoi_diagram.py +++ b/pyGDI/features/vector_features/voronoi_diagram.py @@ -1,5 +1,5 @@ import geopandas as gpd -from common.minio_ops import connect_minio +from pyGDI.common.minio_ops import connect_minio import pickle as pkl import os import uuid diff --git a/node-info-generator/README.md b/pyGDI/node-info-generator/README.md similarity index 100% rename from node-info-generator/README.md rename to pyGDI/node-info-generator/README.md diff --git a/node-info-generator/generated-info.json b/pyGDI/node-info-generator/generated-info.json similarity index 100% rename from node-info-generator/generated-info.json rename to pyGDI/node-info-generator/generated-info.json diff --git a/node-info-generator/node_info_generator.py b/pyGDI/node-info-generator/node_info_generator.py similarity index 100% rename from node-info-generator/node_info_generator.py rename to pyGDI/node-info-generator/node_info_generator.py diff --git a/pyproject.toml b/pyproject.toml index e1833f7..0ec7446 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,10 @@ [tool.poetry] -name = "gdi" +name = "pyGDI" version = "0.1.0" description = "gdi cli for gdi python sdk" authors = ["Your Name "] readme = "README.md" +packages = [{ include = "pyGDI" }] [tool.poetry.dependencies] python = ">=3.12,<4"