From bd56930961014124b7e0d55b0dcf31f86fdbb777 Mon Sep 17 00:00:00 2001 From: Shreya Kakachery Date: Fri, 30 Jan 2026 20:07:57 -0800 Subject: [PATCH 1/9] Update environment to include packages for rendering python code --- environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index 1dbc152..eaa83b0 100644 --- a/environment.yml +++ b/environment.yml @@ -4,5 +4,7 @@ channels: dependencies: - python - ipykernel + - nbformat + - nbclient - pip: - quartodoc From 6548d78a070ff1d42d8e7760cd6fefe1a12e35aa Mon Sep 17 00:00:00 2001 From: Shreya Kakachery Date: Fri, 30 Jan 2026 20:18:26 -0800 Subject: [PATCH 2/9] Create tutorial.qmd --- vignettes/tutorial.qmd | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 vignettes/tutorial.qmd diff --git a/vignettes/tutorial.qmd b/vignettes/tutorial.qmd new file mode 100644 index 0000000..620afc0 --- /dev/null +++ b/vignettes/tutorial.qmd @@ -0,0 +1,86 @@ +--- +title: "Geospatial Toolkit Tutorial" +format: + html: + code-fold: false +--- + +## Introduction + +The `geospatial_toolkit` is designed to simplify common geographic data tasks, such as cleaning coordinate strings, calculating distances, and finding antipodes. This tutorial demonstrates a typical workflow using the package. + +## Installation + +To install the package from TestPyPI, run: + +``` bash +pip install -i https://test.pypi.org/simple/ geospatial-toolkit +``` + +## Basic Usage + +First, let's import the necessary functions: + +``` {python} +from geospatial_toolkit import ( + standardize_latlong, + haversine_distance, + get_antipode, + point_to_city +) +``` + +**1. Cleaning Coordinates** + +Often, geospatial data comes in messy string formats. We can use standardize_latlong to convert these into float tuples. + +``` {python} +lat, lon = standardize_latlong("49.2827", "123.1207") +print(f"Cleaned Coordinates: {lat}, {lon}") +``` + +**2. Calculating Distance** + +Now, let's find the distance between our cleaned Vancouver point and the Eiffel Tower in Paris (48.8584, 2.2945). + +``` {python} +paris = (48.8584, 2.2945) +vancouver = (lat, lon) + +distance = haversine_distance(vancouver, paris, unit='km') +print(f"Distance to Paris: {distance:.2f} km") +``` + + +**3. Finding the Antipode** + +What is directly on the opposite side of the world from our Vancouver point? + +``` {python} +anti_lat, anti_lon = get_antipode((lat, lon)) +print(f"Antipode Coordinates: {anti_lat}, {anti_lon}") +``` + + +**4. Identifying the Nearest City** + +Finally, let's see if there is a major city near that antipode point in the ocean. + +``` {python} +import pandas as pd +from shapely.geometry import Polygon + +data = { + 'city_name': ['Vancouver', 'Port-aux-Français'], + 'geometry': [ + Polygon([(-124, 48), (-122, 48), (-122, 50), (-124, 50)]), + Polygon([(69, -50), (71, -50), (71, -48), (69, -48)]) + ] +} +cities_df = pd.DataFrame(data) + +city_info = point_to_city(49.2827, -123.1207, cities_df) + +print(f"Nearest City to Antipode: {city_info}") +``` + From 8d8ba3fa6a23bcecbc440e09e52c0426854c0fcb Mon Sep 17 00:00:00 2001 From: Shreya Kakachery Date: Fri, 30 Jan 2026 20:19:31 -0800 Subject: [PATCH 3/9] Add tutorial page to website --- _quarto.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_quarto.yml b/_quarto.yml index bc0900d..3ad3d32 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -28,6 +28,8 @@ website: href: index.qmd - text: "Reference" href: reference/index.qmd + - text: "Tutorial" + href: vignettes/tutorial.qmd format: From 3cbaac2cac61af688b285fa5c702877333901f64 Mon Sep 17 00:00:00 2001 From: pat0216 Date: Fri, 30 Jan 2026 23:20:59 -0800 Subject: [PATCH 4/9] Updated docs.yml , added nbformat install to fix build-docs workflow error --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a0d886f..4e0c4f7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: - name: Install hatch run: | python -m pip install --upgrade pip - python -m pip install hatch + python -m pip install hatch nbformat - name: Setup Quarto uses: quarto-dev/quarto-actions/setup@v2 From 5f602e8b09a7dabcf1820b085ffc9208777bb112 Mon Sep 17 00:00:00 2001 From: pat0216 Date: Fri, 30 Jan 2026 23:26:13 -0800 Subject: [PATCH 5/9] reverted previous docs.yml change. Added dependency in correct file -- pyproject.toml for build-docs workflow fix --- .github/workflows/docs.yml | 2 +- pyproject.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4e0c4f7..a0d886f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: - name: Install hatch run: | python -m pip install --upgrade pip - python -m pip install hatch nbformat + python -m pip install hatch - name: Setup Quarto uses: quarto-dev/quarto-actions/setup@v2 diff --git a/pyproject.toml b/pyproject.toml index 9e8fa49..eda9491 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,8 @@ dependencies = [ "geopy>=2.4.0", # For geocoding (place names <-> coordinates eg: Vancouver, Canada -> (49.2827, -123.1207)) "shapely>=2.0.1", # For geometric objects and operations (eg: points, polygons, etc.) "pandas>=2.0.0", # For dataframe usage in tests/functions + "nbformat>=5.10.4", + ] [project.urls] From 1e68820865e017f4acca1f9e747f58ba9c106595 Mon Sep 17 00:00:00 2001 From: pat0216 Date: Fri, 30 Jan 2026 23:29:31 -0800 Subject: [PATCH 6/9] Added jupyter dependency --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 686edd2..721860c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,7 @@ dependencies = [ "geopy>=2.4.0", # For geocoding (place names <-> coordinates eg: Vancouver, Canada -> (49.2827, -123.1207)) "shapely>=2.0.1", # For geometric objects and operations (eg: points, polygons, etc.) "pandas>=2.0.0", # For dataframe usage in tests/functions - "nbformat>=5.10.4", - + "jupyter>=2.0.0", ] [project.urls] From 1e6ca9d4ae2604518ece8d535ff6aed0b4030cd1 Mon Sep 17 00:00:00 2001 From: pat0216 Date: Fri, 30 Jan 2026 23:32:59 -0800 Subject: [PATCH 7/9] updated dependencies in pyproject.toml for build-docs workflow fail --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 721860c..5bf9685 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,9 @@ dependencies = [ "geopy>=2.4.0", # For geocoding (place names <-> coordinates eg: Vancouver, Canada -> (49.2827, -123.1207)) "shapely>=2.0.1", # For geometric objects and operations (eg: points, polygons, etc.) "pandas>=2.0.0", # For dataframe usage in tests/functions - "jupyter>=2.0.0", + "jupyterlab>=4.0", + "nbformat>=5.10.4", + "ipykernel>=6.25.2" ] [project.urls] From 37a7f556907f496182d0499853be83900490790f Mon Sep 17 00:00:00 2001 From: pat0216 Date: Fri, 30 Jan 2026 23:34:08 -0800 Subject: [PATCH 8/9] Revert "Added jupyter dependency" This reverts commit 1e68820865e017f4acca1f9e747f58ba9c106595. --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 5bf9685..b79218f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,8 @@ dependencies = [ "jupyterlab>=4.0", "nbformat>=5.10.4", "ipykernel>=6.25.2" + "nbformat>=5.10.4", + ] [project.urls] From 20ec4d79341864ea68cf1afd1633cb942eb661cb Mon Sep 17 00:00:00 2001 From: PAT0216 Date: Fri, 30 Jan 2026 23:41:00 -0800 Subject: [PATCH 9/9] fix(deps): correct TOML syntax error in dependencies - Remove duplicate nbformat dependency - Add missing comma separator - Fixes build/test failures in CI --- pyproject.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b79218f..a1d5ad8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,15 +32,13 @@ classifiers = [ # TODO: add keywords keywords = [] # Package dependencies -dependencies = [ + dependencies = [ "geopy>=2.4.0", # For geocoding (place names <-> coordinates eg: Vancouver, Canada -> (49.2827, -123.1207)) "shapely>=2.0.1", # For geometric objects and operations (eg: points, polygons, etc.) "pandas>=2.0.0", # For dataframe usage in tests/functions "jupyterlab>=4.0", "nbformat>=5.10.4", - "ipykernel>=6.25.2" - "nbformat>=5.10.4", - + "ipykernel>=6.25.2", ] [project.urls]