giga-spatial 0.6.4__tar.gz → 0.6.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/.env_sample +1 -0
  2. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/CHANGELOG.md +127 -0
  3. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/PKG-INFO +3 -1
  4. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/getting-started/quickstart.md +10 -17
  5. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/user-guide/configuration.md +1 -1
  6. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/giga_spatial.egg-info/PKG-INFO +3 -1
  7. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/giga_spatial.egg-info/SOURCES.txt +3 -0
  8. giga_spatial-0.6.4/requirements.txt → giga_spatial-0.6.6/giga_spatial.egg-info/requires.txt +3 -1
  9. giga_spatial-0.6.6/gigaspatial/__init__.py +1 -0
  10. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/config.py +29 -4
  11. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/__init__.py +1 -0
  12. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/data_api.py +3 -1
  13. giga_spatial-0.6.6/gigaspatial/core/io/database.py +319 -0
  14. giga_spatial-0.6.6/gigaspatial/generators/__init__.py +6 -0
  15. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/generators/poi.py +300 -52
  16. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/generators/zonal/__init__.py +2 -1
  17. giga_spatial-0.6.6/gigaspatial/generators/zonal/admin.py +84 -0
  18. giga_spatial-0.6.6/gigaspatial/generators/zonal/base.py +526 -0
  19. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/generators/zonal/geometry.py +151 -53
  20. giga_spatial-0.6.6/gigaspatial/generators/zonal/mercator.py +109 -0
  21. giga_spatial-0.6.6/gigaspatial/grid/__init__.py +1 -0
  22. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/grid/mercator_tiles.py +33 -10
  23. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/__init__.py +8 -1
  24. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/base.py +26 -6
  25. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/boundaries.py +93 -18
  26. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/ghsl.py +92 -15
  27. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/rwi.py +5 -2
  28. giga_spatial-0.6.6/gigaspatial/handlers/worldpop.py +851 -0
  29. giga_spatial-0.6.6/gigaspatial/processing/algorithms.py +188 -0
  30. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/processing/geo.py +204 -102
  31. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/processing/tif_processor.py +220 -45
  32. giga_spatial-0.6.4/giga_spatial.egg-info/requires.txt → giga_spatial-0.6.6/requirements.txt +2 -0
  33. giga_spatial-0.6.4/gigaspatial/__init__.py +0 -1
  34. giga_spatial-0.6.4/gigaspatial/generators/__init__.py +0 -2
  35. giga_spatial-0.6.4/gigaspatial/generators/zonal/base.py +0 -370
  36. giga_spatial-0.6.4/gigaspatial/generators/zonal/mercator.py +0 -78
  37. giga_spatial-0.6.4/gigaspatial/grid/__init__.py +0 -1
  38. giga_spatial-0.6.4/gigaspatial/handlers/worldpop.py +0 -266
  39. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/CODE_OF_CONDUCT.md +0 -0
  40. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/CONTRIBUTING.md +0 -0
  41. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/LICENSE +0 -0
  42. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/MANIFEST.in +0 -0
  43. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/PULL_REQUEST_TEMPLATE.md +0 -0
  44. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/README.md +0 -0
  45. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/.DS_Store +0 -0
  46. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/core.md +0 -0
  47. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/generators.md +0 -0
  48. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/grid.md +0 -0
  49. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/handlers.md +0 -0
  50. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/index.md +0 -0
  51. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/api/processing.md +0 -0
  52. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/assets/GIGA_horizontal_notext_white.webp +0 -0
  53. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/assets/datasets.png +0 -0
  54. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/assets/logo.png +0 -0
  55. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/changelog.md +0 -0
  56. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/contributing.md +0 -0
  57. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/advanced.md +0 -0
  58. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/basic.md +0 -0
  59. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/downloading/ghsl.md +0 -0
  60. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/downloading/osm.md +0 -0
  61. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/index.md +0 -0
  62. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/processing/tif.md +0 -0
  63. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/examples/use-cases.md +0 -0
  64. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/getting-started/installation.md +0 -0
  65. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/index.md +0 -0
  66. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/license.md +0 -0
  67. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/stylesheets/extra.css +0 -0
  68. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/docs/user-guide/index.md +0 -0
  69. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/giga_spatial.egg-info/dependency_links.txt +0 -0
  70. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/giga_spatial.egg-info/top_level.txt +0 -0
  71. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/__init__.py +0 -0
  72. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/adls_data_store.py +0 -0
  73. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/data_store.py +0 -0
  74. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/local_data_store.py +0 -0
  75. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/readers.py +0 -0
  76. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/io/writers.py +0 -0
  77. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/schemas/__init__.py +0 -0
  78. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/core/schemas/entity.py +0 -0
  79. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/giga.py +0 -0
  80. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/google_open_buildings.py +0 -0
  81. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/hdx.py +0 -0
  82. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/mapbox_image.py +0 -0
  83. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/maxar_image.py +0 -0
  84. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/microsoft_global_buildings.py +0 -0
  85. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/ookla_speedtest.py +0 -0
  86. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/opencellid.py +0 -0
  87. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/osm.py +0 -0
  88. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/overture.py +0 -0
  89. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/handlers/unicef_georepo.py +0 -0
  90. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/processing/__init__.py +0 -0
  91. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/processing/sat_images.py +0 -0
  92. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/gigaspatial/processing/utils.py +0 -0
  93. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/pyproject.toml +0 -0
  94. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/setup.cfg +0 -0
  95. {giga_spatial-0.6.4 → giga_spatial-0.6.6}/setup.py +0 -0
@@ -4,6 +4,7 @@ export GOOGLE_SERVICE_ACCOUNT=""
4
4
  export API_PROFILE_FILE_PATH=""
5
5
  export API_SHARE_NAME=""
6
6
  export API_SCHEMA_NAME=""
7
+ export DB_CONFIG='{}'
7
8
  export MAPBOX_ACCESS_TOKEN=""
8
9
  export MAXAR_USERNAME=""
9
10
  export MAXAR_PASSWORD=""
@@ -2,6 +2,133 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [v0.6.6] - 2025-07-15
6
+
7
+ ### Added
8
+
9
+ - **`AdminBoundaries.from_global_country_boundaries(scale="medium")`**
10
+ - New class method to load global admin level 0 boundaries from Natural Earth.
11
+ - Supports `"large"` (10m), `"medium"` (50m), and `"small"` (110m) scale options.
12
+
13
+ - **WorldPop Handler Refactor (API Integration)**
14
+ - Introduced `WPPopulationHandler`, `WPPopulationConfig`, `WPPopulationDownloader`, and `WPPopulationReader`.
15
+ - Uses new `WorldPopRestClient` to dynamically query the WorldPop REST API.
16
+ - Replaces static metadata files and hardcoded logic with API-based discovery and download.
17
+ - Country code lookup and dataset filtering now handled at runtime.
18
+ - Improved validation, extensibility, logging, and error handling.
19
+
20
+ - **POI-Based WorldPop Mapping**
21
+ - `PoiViewGenerator.map_wp_pop()` method:
22
+ - Maps WorldPop population data around POIs using flexible spatial predicates:
23
+ - `"centroid_within"`, `"intersects"`, `"fractional"` (1000m only), `"within"`
24
+ - Supports configurable radius and resolution (100m or 1000m).
25
+ - Aggregates population data and appends it to the view.
26
+
27
+ - **Geometry-Based Zonal WorldPop Mapping**
28
+ - `GeometryBasedZonalViewGenerator.map_wp_pop()` method:
29
+ - Maps WorldPop population data to polygons/zones using:
30
+ - `"intersects"` or `"fractional"` predicate
31
+ - Returns zonal population sums as a new view column.
32
+ - Handles predicate-dependent data loading (raster vs. GeoDataFrame).
33
+
34
+ ### Changed
35
+
36
+ - **Refactored `BaseHandler.ensure_data_available`**
37
+ - More efficient data check and download logic.
38
+ - Downloads only missing units unless `force_download=True`.
39
+ - Cleaner structure and better reuse of `get_relevant_data_units()`.
40
+
41
+ - **Refactored WorldPop Module**
42
+ - Complete handler redesign using API-based architecture.
43
+ - Dataset paths and URLs are now dynamically constructed from API metadata.
44
+ - Resolution/year validation is more robust and descriptive.
45
+ - Removed static constants, gender/school_age toggles, and local CSV dependency.
46
+
47
+ ### Fixed
48
+ - Several small fixes and improvements to zonal aggregation methods, especially around CRS consistency, missing values, and result alignment.
49
+
50
+ ## [v0.6.5] - 2025-07-01
51
+
52
+ ### Added
53
+
54
+ - **`MercatorTiles.get_quadkeys_from_points()`**
55
+ New static method for efficient 1:1 point-to-quadkey mapping using coordinate-based logic, improving performance over spatial joins.
56
+
57
+ - **`AdminBoundariesViewGenerator`**
58
+ New generator class for producing zonal views based on administrative boundaries (e.g., districts, provinces) with flexible source and admin level support.
59
+
60
+ - **Zonal View Generator Enhancements**
61
+ - `_view`: Internal attribute for accumulating mapped statistics.
62
+ - `view`: Exposes current state of zonal view.
63
+ - `add_variable_to_view()`: Adds mapped data from `map_points`, `map_polygons`, or `map_rasters` with robust validation and zone alignment.
64
+ - `to_dataframe()` and `to_geodataframe()` methods added for exporting current view in tabular or spatial formats.
65
+
66
+ - **`PoiViewGenerator` Enhancements**
67
+ - Consistent `_view` DataFrame for storing mapped results.
68
+ - `_update_view()`: Central method to update POI data.
69
+ - `save_view()`: Improved format handling (CSV, Parquet, GeoJSON, etc.) with geometry recovery.
70
+ - `to_dataframe()` and `to_geodataframe()` methods added for convenient export of enriched POI view.
71
+ - Robust duplicate ID detection and CRS validation in `map_zonal_stats`.
72
+
73
+ - **`TifProcessor` Enhancements**
74
+ - `sample_by_polygons_batched()`: Parallel polygon sampling.
75
+ - Enhanced `sample_by_polygons()` with nodata masking and multiple stats.
76
+ - `warn_on_error`: Flag to suppress sampling warnings.
77
+
78
+ - **GeoTIFF Multi-Band Support**
79
+ - `multi` mode added for multi-band raster support.
80
+ - Auto-detects band names via metadata.
81
+ - Strict validation of band count based on mode (`single`, `rgb`, `rgba`, `multi`).
82
+
83
+ - **Spatial Distance Graph Algorithm**
84
+ - `build_distance_graph()` added for fast KD-tree-based spatial matching.
85
+ - Supports both `DataFrame` and `GeoDataFrame` inputs.
86
+ - Outputs a `networkx.Graph` with optional DataFrame of matches.
87
+ - Handles projections, self-match exclusion, and includes verbose stats/logs.
88
+
89
+ - **Database Integration (Experimental)**
90
+ - Added `DBConnection` class in `core/io/database.py` for unified Trino and PostgreSQL access.
91
+ - Supports schema/table introspection, query execution, and reading into `pandas` or `dask`.
92
+ - Handles connection creation, credential management, and diagnostics.
93
+ - Utility methods for schema/view/table/column listings and parameterized queries.
94
+
95
+ - **GHSL Population Mapping**
96
+ - `map_ghsl_pop()` method added to `GeometryBasedZonalViewGenerator`.
97
+ - Aggregates GHSL population rasters to user-defined zones.
98
+ - Supports `intersects` and `fractional` predicates (latter for 1000m resolution only).
99
+ - Returns population statistics (e.g., `sum`) with customizable column prefix.
100
+
101
+ ### Changed
102
+
103
+ - **`MercatorTiles.from_points()`** now internally uses `get_quadkeys_from_points()` for better performance.
104
+
105
+ - **`map_points()` and `map_rasters()`** now return `Dict[zone_id, value]` to support direct usage with `add_variable_to_view()`.
106
+
107
+ - **Refactored `aggregate_polygons_to_zones()`**
108
+ - `area_weighted` deprecated in favor of `predicate`.
109
+ - Supports flexible predicates like `"within"`, `"fractional"` for spatial aggregation.
110
+ - `map_polygons()` updated to reflect this change.
111
+
112
+ - **Optional Admin Boundaries Configuration**
113
+ - `ADMIN_BOUNDARIES_DATA_DIR` is now optional.
114
+ - `AdminBoundaries.create()` only attempts to load if explicitly configured or path is provided.
115
+ - Improved documentation and fallback behavior for missing configs.
116
+
117
+ ### Fixed
118
+
119
+ - **GHSL Downloader**
120
+ - ZIP files are now downloaded into a temporary cache directory using `requests.get()`.
121
+ - Avoids unnecessary writes and ensures cleanup.
122
+
123
+ - **`TifProcessor`**
124
+ - Removed polygon sampling warnings unless explicitly enabled.
125
+
126
+ ### Deprecated
127
+
128
+ - `TifProcessor.tabular` → use `to_dataframe()` instead.
129
+ - `TifProcessor.get_zoned_geodataframe()` → use `to_geodataframe()` instead.
130
+ - `area_weighted` → use `predicate` in aggregation methods instead.
131
+
5
132
  ## [v0.6.4] - 2025-06-19
6
133
 
7
134
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: giga-spatial
3
- Version: 0.6.4
3
+ Version: 0.6.6
4
4
  Summary: A package for spatial data download & processing
5
5
  Home-page: https://github.com/unicef/giga-spatial
6
6
  Author: Utku Can Ozturk
@@ -31,6 +31,8 @@ Requires-Dist: OWSLib==0.32.1
31
31
  Requires-Dist: pydantic-settings>=2.7.1
32
32
  Requires-Dist: hdx-python-api>=6.3.8
33
33
  Requires-Dist: bs4==0.0.2
34
+ Requires-Dist: sqlalchemy-trino==0.5.0
35
+ Requires-Dist: dask>=2024.12.1
34
36
  Dynamic: author
35
37
  Dynamic: author-email
36
38
  Dynamic: classifier
@@ -16,43 +16,36 @@ import gigaspatial as gs
16
16
 
17
17
  ## Setting Up Configuration
18
18
 
19
- The `gigaspatial` package uses a configuration file (`config.py`) to manage paths, API keys, and other settings. You can customize the configuration as needed.
19
+ The `gigaspatial` package uses a unified configuration system to manage paths, API keys, and other settings.
20
20
 
21
- ### Using Environment Variables
21
+ - **Environment Variables:** Most configuration is handled via environment variables, which can be set in a `.env` file at the project root. For a full list of supported variables and their descriptions, see the [Configuration Guide](../user-guide/configuration.md).
22
+ - **Defaults:** If not set, sensible defaults are used for all paths and keys.
23
+ - **Manual Overrides:** You can override data directory paths in your code using `config.set_path`.
22
24
 
23
- The package can read configuration settings from an environment file (e.g., `.env`). Here's an example of how to set up the `.env` file based on the `env_sample`:
25
+ ### Example `.env` File
24
26
 
25
27
  ```bash
26
- # Paths for different data types
27
28
  BRONZE_DIR=/path/to/your/bronze_tier_data
28
29
  SILVER_DIR=/path/to/your/silver_tier_data
29
30
  GOLD_DIR=/path/to/your/gold_tier_data
30
31
  VIEWS_DIR=/path/to/your/views_data
31
- ADMIN_BOUNDARIES_DIR=/path/to/your/admin_boundaries_data
32
-
33
- # API keys and tokens
32
+ CACHE_DIR=/path/to/your/cache
33
+ ADMIN_BOUNDARIES_DIR=/path/to/your/admin_boundaries
34
34
  MAPBOX_ACCESS_TOKEN=your_mapbox_token_here
35
- MAXAR_USERNAME=your_maxar_username_here
36
- MAXAR_PASSWORD=your_maxar_password_here
37
- MAXAR_CONNECTION_STRING=your_maxar_key_here
35
+ # ... other keys ...
38
36
  ```
39
37
 
40
- The `config.py` file will automatically read these environment variables and set the paths and keys accordingly.
41
-
42
- ### Setting Paths Manually
43
-
44
- You can also set paths manually in your code:
38
+ ### Setting Paths Programmatically
45
39
 
46
40
  ```python
47
41
  from gigaspatial.config import config
48
42
 
49
- # Example: Setting custom data storage paths
50
43
  config.set_path("bronze", "/path/to/your/bronze_tier_data")
51
44
  config.set_path("gold", "/path/to/your/gold_tier_data")
52
45
  config.set_path("views", "/path/to/your/views_data")
53
46
  ```
54
47
 
55
- API keys and tokens should be set through environment variables.
48
+ > For more details and troubleshooting, see the [full configuration guide](../user-guide/configuration.md).
56
49
 
57
50
  ## Downloading and Processing Geospatial Data
58
51
 
@@ -123,7 +123,7 @@ print(config)
123
123
 
124
124
  ## Next Steps
125
125
 
126
- Once configuration is set up, proceed to the [Data Handling Guide](data-handling/downloading.md) to start using `gigaspatial`.
126
+ Once configuration is set up, proceed to the [Data Handling Guide](data-handling/downloading.md) *(Coming Soon)* to start using `gigaspatial`.
127
127
 
128
128
  ---
129
129
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: giga-spatial
3
- Version: 0.6.4
3
+ Version: 0.6.6
4
4
  Summary: A package for spatial data download & processing
5
5
  Home-page: https://github.com/unicef/giga-spatial
6
6
  Author: Utku Can Ozturk
@@ -31,6 +31,8 @@ Requires-Dist: OWSLib==0.32.1
31
31
  Requires-Dist: pydantic-settings>=2.7.1
32
32
  Requires-Dist: hdx-python-api>=6.3.8
33
33
  Requires-Dist: bs4==0.0.2
34
+ Requires-Dist: sqlalchemy-trino==0.5.0
35
+ Requires-Dist: dask>=2024.12.1
34
36
  Dynamic: author
35
37
  Dynamic: author-email
36
38
  Dynamic: classifier
@@ -47,6 +47,7 @@ gigaspatial/core/io/__init__.py
47
47
  gigaspatial/core/io/adls_data_store.py
48
48
  gigaspatial/core/io/data_api.py
49
49
  gigaspatial/core/io/data_store.py
50
+ gigaspatial/core/io/database.py
50
51
  gigaspatial/core/io/local_data_store.py
51
52
  gigaspatial/core/io/readers.py
52
53
  gigaspatial/core/io/writers.py
@@ -55,6 +56,7 @@ gigaspatial/core/schemas/entity.py
55
56
  gigaspatial/generators/__init__.py
56
57
  gigaspatial/generators/poi.py
57
58
  gigaspatial/generators/zonal/__init__.py
59
+ gigaspatial/generators/zonal/admin.py
58
60
  gigaspatial/generators/zonal/base.py
59
61
  gigaspatial/generators/zonal/geometry.py
60
62
  gigaspatial/generators/zonal/mercator.py
@@ -78,6 +80,7 @@ gigaspatial/handlers/rwi.py
78
80
  gigaspatial/handlers/unicef_georepo.py
79
81
  gigaspatial/handlers/worldpop.py
80
82
  gigaspatial/processing/__init__.py
83
+ gigaspatial/processing/algorithms.py
81
84
  gigaspatial/processing/geo.py
82
85
  gigaspatial/processing/sat_images.py
83
86
  gigaspatial/processing/tif_processor.py
@@ -15,4 +15,6 @@ tqdm==4.65.0
15
15
  OWSLib==0.32.1
16
16
  pydantic-settings>=2.7.1
17
17
  hdx-python-api>=6.3.8
18
- bs4==0.0.2
18
+ bs4==0.0.2
19
+ sqlalchemy-trino==0.5.0
20
+ dask>=2024.12.1
@@ -0,0 +1 @@
1
+ __version__ = "0.6.6"
@@ -70,11 +70,12 @@ class Config(BaseSettings):
70
70
  description="Directory for temporary/cache files",
71
71
  alias="CACHE_DIR",
72
72
  )
73
- ADMIN_BOUNDARIES_DATA_DIR: Path = Field(
74
- default=Path("admin_boundaries"),
73
+ ADMIN_BOUNDARIES_DATA_DIR: Optional[Path] = Field(
74
+ default=None,
75
75
  description="Root directory for administrative boundary data",
76
76
  alias="ADMIN_BOUNDARIES_DIR",
77
77
  )
78
+ DB_CONFIG: Optional[Dict] = Field(default=None, alias="DB_CONFIG")
78
79
 
79
80
  DATA_TYPES: Dict[str, str] = Field(
80
81
  default={
@@ -156,6 +157,11 @@ class Config(BaseSettings):
156
157
  ) -> Path:
157
158
  """Dynamic path construction for administrative boundary data based on admin level."""
158
159
  base_dir = getattr(self, "ADMIN_BOUNDARIES_DATA_DIR")
160
+ if base_dir is None:
161
+ raise ValueError(
162
+ "ADMIN_BOUNDARIES_DATA_DIR is not configured. "
163
+ "Please set the ADMIN_BOUNDARIES_DIR environment variable."
164
+ )
159
165
  level_dir = f"admin{admin_level}"
160
166
  file = f"{country_code}_{level_dir}{file_suffix}"
161
167
 
@@ -174,7 +180,6 @@ class Config(BaseSettings):
174
180
  "SILVER_DATA_DIR",
175
181
  "GOLD_DATA_DIR",
176
182
  "CACHE_DIR",
177
- "ADMIN_BOUNDARIES_DATA_DIR",
178
183
  mode="before",
179
184
  )
180
185
  def resolve_and_validate_paths(
@@ -192,10 +197,30 @@ class Config(BaseSettings):
192
197
  resolved = path.expanduser().resolve()
193
198
  return resolved if resolve else path
194
199
 
200
+ @field_validator("ADMIN_BOUNDARIES_DATA_DIR", mode="before")
201
+ def validate_admin_boundaries_dir(
202
+ cls, value: Union[str, Path, None]
203
+ ) -> Optional[Path]:
204
+ """Validator for ADMIN_BOUNDARIES_DATA_DIR that handles None and string values."""
205
+ if value is None:
206
+ return None
207
+ if isinstance(value, str):
208
+ return Path(value)
209
+ elif isinstance(value, Path):
210
+ return value
211
+ else:
212
+ raise ValueError(
213
+ f"Invalid path type for ADMIN_BOUNDARIES_DATA_DIR: {type(value)}"
214
+ )
215
+
195
216
  def ensure_directories_exist(self, create: bool = False) -> None:
196
217
  """Ensures all configured directories exist."""
197
218
  for field_name, field_value in self.__dict__.items():
198
- if isinstance(field_value, Path) and not field_value.exists():
219
+ if (
220
+ isinstance(field_value, Path)
221
+ and field_value is not None
222
+ and not field_value.exists()
223
+ ):
199
224
  if create:
200
225
  field_value.mkdir(parents=True, exist_ok=True)
201
226
  else:
@@ -1,5 +1,6 @@
1
1
  from gigaspatial.core.io.adls_data_store import ADLSDataStore
2
2
  from gigaspatial.core.io.local_data_store import LocalDataStore
3
3
  from gigaspatial.core.io.data_api import GigaDataAPI
4
+ from gigaspatial.core.io.database import DBConnection
4
5
  from gigaspatial.core.io.readers import *
5
6
  from gigaspatial.core.io.writers import *
@@ -35,7 +35,9 @@ class GigaDataAPI:
35
35
  :param sort: Whether to sort the country list alphabetically (default is True).
36
36
  """
37
37
  country_list = [
38
- t.name for t in self.client.list_all_tables() if t.share == self.share_name
38
+ t.name
39
+ for t in self.client.list_all_tables()
40
+ if t.schema == self.schema_name
39
41
  ]
40
42
  if sort:
41
43
  country_list.sort()