vector2dggs 0.25.0__tar.gz → 0.26.2__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.
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/PKG-INFO +19 -9
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/README.md +17 -7
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/pyproject.toml +11 -3
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/cli.py +2 -2
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/cli_factory.py +4 -5
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/common.py +140 -119
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/constants.py +2 -2
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexerfactory.py +3 -2
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/a5vectorindexer.py +24 -12
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/geohashvectorindexer.py +12 -8
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/h3vectorindexer.py +28 -18
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/rhpvectorindexer.py +18 -12
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/s2vectorindexer.py +6 -6
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/vectorindexer.py +51 -24
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/katana.py +5 -7
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/spikes.py +10 -4
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/COPYING +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/COPYING.LESSER +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/__init__.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/a5.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/geohash.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/h3.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/indexers/__init__.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/rHP.py +0 -0
- {vector2dggs-0.25.0 → vector2dggs-0.26.2}/vector2dggs/s2.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vector2dggs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.26.2
|
|
4
4
|
Summary: CLI DGGS indexer for vector geospatial data
|
|
5
5
|
License: LGPL-3.0-or-later
|
|
6
6
|
License-File: COPYING
|
|
@@ -35,7 +35,7 @@ Requires-Dist: geopandas (>=1.1.2,<2.0.0)
|
|
|
35
35
|
Requires-Dist: h3 (>=4.1,<5.0) ; extra == "h3" or extra == "all"
|
|
36
36
|
Requires-Dist: numpy (>=2,<3)
|
|
37
37
|
Requires-Dist: psycopg2-binary (>=2.9.9,<3.0.0) ; extra == "postgres" or extra == "all"
|
|
38
|
-
Requires-Dist: pya5 (>=0.
|
|
38
|
+
Requires-Dist: pya5 (>=1.0.0,<2.0.0) ; extra == "a5" or extra == "all"
|
|
39
39
|
Requires-Dist: pyarrow (>=23.0.1,<24.0.0)
|
|
40
40
|
Requires-Dist: pyogrio (>=0.13,<0.14)
|
|
41
41
|
Requires-Dist: pyproj (>=3.7,<4.0)
|
|
@@ -88,6 +88,8 @@ A bare `pip install vector2dggs` **will not install any DGGS backends**.
|
|
|
88
88
|
|
|
89
89
|
PostgreSQL/PostGIS input requires the `postgres` extra (e.g. `pip install vector2dggs[h3,postgres]`); it is included in `all`.
|
|
90
90
|
|
|
91
|
+
The `a5` extra uses the [A5 v1 index](https://a5geo.org/blog/2026/10/14/a5-v1) (from vector2dggs 0.26.0). A5 cell IDs written by earlier versions used the v0 index and are not compatible; [`a5.migrate`](https://a5geo.org/docs/api-reference/miscellaneous#migrate) converts them.
|
|
92
|
+
|
|
91
93
|
|
|
92
94
|
## Usage
|
|
93
95
|
|
|
@@ -101,8 +103,8 @@ vector2dggs <dggs> [OPTIONS] VECTOR_INPUT OUTPUT_DIRECTORY
|
|
|
101
103
|
|
|
102
104
|
- `-r`/`--resolution`: the target DGGS resolution. Each output row is one (feature, cell) pair; by default a cell is included when its centre point falls inside the feature, uniformly across all backends (see `-m`/`--mode`).
|
|
103
105
|
- `-pr`/`--parent_res`: a coarser resolution used to partition the output (hive directories such as `h3_03=…`); defaults to a fixed offset below the target resolution.
|
|
104
|
-
- `-id`/`--id_field`: the feature identifier carried into the output. Defaults to the input's own internal ID where one exists (a GPKG's FID column, or a DB table's
|
|
105
|
-
- `-co`/`--compact`: merges complete sets of sibling cells belonging to one feature (grouped by whichever id_field is in play, explicit, auto-detected, or synthetic), to no coarser than the parent resolution. Compacted output expands back to exactly the full-resolution result.
|
|
106
|
+
- `-id`/`--id_field`: the feature identifier carried into the output. Repeat it for a composite identifier (`-id region -id parcel_no`): each field becomes an output column, in the order given, and rows sharing the whole key are treated as one feature. Defaults to the input's own internal ID where one exists (a GPKG's FID column, or a DB table's primary key, every column of a composite one); otherwise falls back to a synthetic index tied to row position in the read order — stable across repeated runs of the same unchanged input, but not portable to a different export/copy of the same data.
|
|
107
|
+
- `-co`/`--compact`: merges complete sets of sibling cells belonging to one feature (grouped by whichever id_field is in play, explicit, auto-detected, or synthetic, and by the joint key when it is composite), to no coarser than the parent resolution. Compacted output expands back to exactly the full-resolution result.
|
|
106
108
|
- `--geo`: plain Parquet by default; `point` or `polygon` writes GeoParquet (v1.1.0) cell geometries instead.
|
|
107
109
|
- `-m`/`--mode`: which of a polygon's cells are indexed. See [Containment modes](#containment-modes) below.
|
|
108
110
|
- `--cell-id`: `string` (default) or `uint64`. DGGS with a native integer cell form (A5, H3, S2) can write cell IDs as unsigned 64-bit integers instead of text — useful where downstream tools take integer cell IDs directly (e.g. DuckDB's `h3` extension). Cell IDs are worked in the native form internally regardless of this flag; it only controls the final output rendering. String-only DGGS (rHEALPix, Geohash) reject `--cell-id uint64`.
|
|
@@ -131,10 +133,12 @@ Options:
|
|
|
131
133
|
-pr, --parent_res [0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15]
|
|
132
134
|
H3 parent resolution for the output partition.
|
|
133
135
|
Defaults to resolution - 6
|
|
134
|
-
-id, --id_field TEXT Field to use as an ID;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
-id, --id_field TEXT Field to use as an ID; repeat for a composite
|
|
137
|
+
ID (one output column per field, in the order
|
|
138
|
+
given). Defaults to the input's own internal
|
|
139
|
+
ID if it has one (e.g. a GPKG's FID column, or
|
|
140
|
+
a DB table's primary key, every column of a
|
|
141
|
+
composite key), otherwise falls back to a
|
|
138
142
|
constructed 0...n index on the original
|
|
139
143
|
feature order.
|
|
140
144
|
-k, --keep_attributes Retain attributes in output. The default is to
|
|
@@ -245,7 +249,7 @@ Compaction is supported with the `-co/--compact` argument. A complete set of sib
|
|
|
245
249
|
|
|
246
250
|

|
|
247
251
|
|
|
248
|
-
Compaction respects overlapping polygons by considering each feature independently. This does mean that the index of the result is not necessarily unique (unless your input is a vector _coverage_, i.e. it does not have overlaps — as the example above is, so each of its cells belongs to exactly one feature). Where features do overlap, a cell covered by two of them appears once per feature.
|
|
252
|
+
Compaction respects overlapping polygons by considering each feature independently, a feature being the rows that share an id (the whole key, for a composite `-id`). This does mean that the index of the result is not necessarily unique (unless your input is a vector _coverage_, i.e. it does not have overlaps — as the example above is, so each of its cells belongs to exactly one feature). Where features do overlap, a cell covered by two of them appears once per feature.
|
|
249
253
|
|
|
250
254
|
### For development
|
|
251
255
|
|
|
@@ -308,6 +312,12 @@ Indexing small polygons without losing any of them (see [Containment modes](#con
|
|
|
308
312
|
vector2dggs s2 -id parcel_id -r 16 -m intersects ./parcels.gpkg ./parcels.parquet
|
|
309
313
|
```
|
|
310
314
|
|
|
315
|
+
With a composite identifier, compacting per feature on the joint key:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
vector2dggs h3 -id region -id parcel_no -co -r 12 ./parcels.gpkg ./parcels.parquet
|
|
319
|
+
```
|
|
320
|
+
|
|
311
321
|
With a PostgreSQL/PostGIS connection:
|
|
312
322
|
|
|
313
323
|
```bash
|
|
@@ -37,6 +37,8 @@ A bare `pip install vector2dggs` **will not install any DGGS backends**.
|
|
|
37
37
|
|
|
38
38
|
PostgreSQL/PostGIS input requires the `postgres` extra (e.g. `pip install vector2dggs[h3,postgres]`); it is included in `all`.
|
|
39
39
|
|
|
40
|
+
The `a5` extra uses the [A5 v1 index](https://a5geo.org/blog/2026/10/14/a5-v1) (from vector2dggs 0.26.0). A5 cell IDs written by earlier versions used the v0 index and are not compatible; [`a5.migrate`](https://a5geo.org/docs/api-reference/miscellaneous#migrate) converts them.
|
|
41
|
+
|
|
40
42
|
|
|
41
43
|
## Usage
|
|
42
44
|
|
|
@@ -50,8 +52,8 @@ vector2dggs <dggs> [OPTIONS] VECTOR_INPUT OUTPUT_DIRECTORY
|
|
|
50
52
|
|
|
51
53
|
- `-r`/`--resolution`: the target DGGS resolution. Each output row is one (feature, cell) pair; by default a cell is included when its centre point falls inside the feature, uniformly across all backends (see `-m`/`--mode`).
|
|
52
54
|
- `-pr`/`--parent_res`: a coarser resolution used to partition the output (hive directories such as `h3_03=…`); defaults to a fixed offset below the target resolution.
|
|
53
|
-
- `-id`/`--id_field`: the feature identifier carried into the output. Defaults to the input's own internal ID where one exists (a GPKG's FID column, or a DB table's
|
|
54
|
-
- `-co`/`--compact`: merges complete sets of sibling cells belonging to one feature (grouped by whichever id_field is in play, explicit, auto-detected, or synthetic), to no coarser than the parent resolution. Compacted output expands back to exactly the full-resolution result.
|
|
55
|
+
- `-id`/`--id_field`: the feature identifier carried into the output. Repeat it for a composite identifier (`-id region -id parcel_no`): each field becomes an output column, in the order given, and rows sharing the whole key are treated as one feature. Defaults to the input's own internal ID where one exists (a GPKG's FID column, or a DB table's primary key, every column of a composite one); otherwise falls back to a synthetic index tied to row position in the read order — stable across repeated runs of the same unchanged input, but not portable to a different export/copy of the same data.
|
|
56
|
+
- `-co`/`--compact`: merges complete sets of sibling cells belonging to one feature (grouped by whichever id_field is in play, explicit, auto-detected, or synthetic, and by the joint key when it is composite), to no coarser than the parent resolution. Compacted output expands back to exactly the full-resolution result.
|
|
55
57
|
- `--geo`: plain Parquet by default; `point` or `polygon` writes GeoParquet (v1.1.0) cell geometries instead.
|
|
56
58
|
- `-m`/`--mode`: which of a polygon's cells are indexed. See [Containment modes](#containment-modes) below.
|
|
57
59
|
- `--cell-id`: `string` (default) or `uint64`. DGGS with a native integer cell form (A5, H3, S2) can write cell IDs as unsigned 64-bit integers instead of text — useful where downstream tools take integer cell IDs directly (e.g. DuckDB's `h3` extension). Cell IDs are worked in the native form internally regardless of this flag; it only controls the final output rendering. String-only DGGS (rHEALPix, Geohash) reject `--cell-id uint64`.
|
|
@@ -80,10 +82,12 @@ Options:
|
|
|
80
82
|
-pr, --parent_res [0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15]
|
|
81
83
|
H3 parent resolution for the output partition.
|
|
82
84
|
Defaults to resolution - 6
|
|
83
|
-
-id, --id_field TEXT Field to use as an ID;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
-id, --id_field TEXT Field to use as an ID; repeat for a composite
|
|
86
|
+
ID (one output column per field, in the order
|
|
87
|
+
given). Defaults to the input's own internal
|
|
88
|
+
ID if it has one (e.g. a GPKG's FID column, or
|
|
89
|
+
a DB table's primary key, every column of a
|
|
90
|
+
composite key), otherwise falls back to a
|
|
87
91
|
constructed 0...n index on the original
|
|
88
92
|
feature order.
|
|
89
93
|
-k, --keep_attributes Retain attributes in output. The default is to
|
|
@@ -194,7 +198,7 @@ Compaction is supported with the `-co/--compact` argument. A complete set of sib
|
|
|
194
198
|
|
|
195
199
|

|
|
196
200
|
|
|
197
|
-
Compaction respects overlapping polygons by considering each feature independently. This does mean that the index of the result is not necessarily unique (unless your input is a vector _coverage_, i.e. it does not have overlaps — as the example above is, so each of its cells belongs to exactly one feature). Where features do overlap, a cell covered by two of them appears once per feature.
|
|
201
|
+
Compaction respects overlapping polygons by considering each feature independently, a feature being the rows that share an id (the whole key, for a composite `-id`). This does mean that the index of the result is not necessarily unique (unless your input is a vector _coverage_, i.e. it does not have overlaps — as the example above is, so each of its cells belongs to exactly one feature). Where features do overlap, a cell covered by two of them appears once per feature.
|
|
198
202
|
|
|
199
203
|
### For development
|
|
200
204
|
|
|
@@ -257,6 +261,12 @@ Indexing small polygons without losing any of them (see [Containment modes](#con
|
|
|
257
261
|
vector2dggs s2 -id parcel_id -r 16 -m intersects ./parcels.gpkg ./parcels.parquet
|
|
258
262
|
```
|
|
259
263
|
|
|
264
|
+
With a composite identifier, compacting per feature on the joint key:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
vector2dggs h3 -id region -id parcel_no -co -r 12 ./parcels.gpkg ./parcels.parquet
|
|
268
|
+
```
|
|
269
|
+
|
|
260
270
|
With a PostgreSQL/PostGIS connection:
|
|
261
271
|
|
|
262
272
|
```bash
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "vector2dggs"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.26.2"
|
|
4
4
|
description = "CLI DGGS indexer for vector geospatial data"
|
|
5
|
-
authors = [
|
|
5
|
+
authors = [
|
|
6
|
+
"James Ardo <ardoj@landcareresearch.co.nz>",
|
|
7
|
+
"Nicoletta De Maio",
|
|
8
|
+
"Richard Law <lawr@landcareresearch.co.nz>"
|
|
9
|
+
]
|
|
6
10
|
maintainers = ["Richard Law <lawr@landcareresearch.co.nz>"]
|
|
7
11
|
readme = "README.md"
|
|
8
12
|
license = "LGPL-3.0-or-later"
|
|
@@ -31,7 +35,7 @@ rhealpixdggs = { version = "^0.8.5", optional = true}
|
|
|
31
35
|
s2geometry = { version = "^0.14.0", optional = true}
|
|
32
36
|
rusty-polygon-geohasher = { version = "^0.2.3", optional = true}
|
|
33
37
|
python-geohash = { version = "^0.8.5", optional = true}
|
|
34
|
-
pya5 = { version = "^0.
|
|
38
|
+
pya5 = { version = "^1.0.0", optional = true }
|
|
35
39
|
psycopg2-binary = { version = "^2.9.9", optional = true }
|
|
36
40
|
antimeridian = "^0.4.8"
|
|
37
41
|
|
|
@@ -70,6 +74,10 @@ ignore = ["E501"] # line length is black's job
|
|
|
70
74
|
python_version = "3.11"
|
|
71
75
|
ignore_missing_imports = true
|
|
72
76
|
check_untyped_defs = true
|
|
77
|
+
disallow_untyped_defs = true
|
|
78
|
+
disallow_incomplete_defs = true
|
|
79
|
+
warn_return_any = true
|
|
80
|
+
disallow_any_generics = true
|
|
73
81
|
|
|
74
82
|
[tool.poetry.extras]
|
|
75
83
|
h3 = ["h3"]
|
|
@@ -10,7 +10,7 @@ from vector2dggs.s2 import s2
|
|
|
10
10
|
|
|
11
11
|
@click.group()
|
|
12
12
|
@click.version_option(version=__version__)
|
|
13
|
-
def cli():
|
|
13
|
+
def cli() -> None:
|
|
14
14
|
pass
|
|
15
15
|
|
|
16
16
|
|
|
@@ -21,5 +21,5 @@ cli.add_command(s2)
|
|
|
21
21
|
cli.add_command(geohash)
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def main():
|
|
24
|
+
def main() -> None:
|
|
25
25
|
cli()
|
|
@@ -42,11 +42,10 @@ def make_dggs_command(
|
|
|
42
42
|
@click.option(
|
|
43
43
|
"-id",
|
|
44
44
|
"--id_field",
|
|
45
|
-
|
|
45
|
+
multiple=True,
|
|
46
46
|
default=const.DEFAULTS["id"],
|
|
47
47
|
type=str,
|
|
48
|
-
help="Field to use as an ID;
|
|
49
|
-
nargs=1,
|
|
48
|
+
help="Field to use as an ID; repeat for a composite ID (one output column per field, in the order given). Defaults to the input's own internal ID if it has one (e.g. a GPKG's FID column, or a DB table's primary key, every column of a composite key), otherwise falls back to a constructed 0...n index on the original feature order.",
|
|
50
49
|
)
|
|
51
50
|
@click.option(
|
|
52
51
|
"-k",
|
|
@@ -187,7 +186,7 @@ def make_dggs_command(
|
|
|
187
186
|
output_directory: str | Path,
|
|
188
187
|
resolution: str,
|
|
189
188
|
parent_res: str,
|
|
190
|
-
id_field: str
|
|
189
|
+
id_field: tuple[str, ...],
|
|
191
190
|
keep_attributes: bool,
|
|
192
191
|
keep_attribute: tuple[str, ...],
|
|
193
192
|
processes: int,
|
|
@@ -201,7 +200,7 @@ def make_dggs_command(
|
|
|
201
200
|
tempdir: str | Path,
|
|
202
201
|
compact: bool,
|
|
203
202
|
overwrite: bool,
|
|
204
|
-
):
|
|
203
|
+
) -> None:
|
|
205
204
|
tempfile.tempdir = str(tempdir) if tempdir is not None else tempfile.tempdir
|
|
206
205
|
common.raise_rlimit_nofile()
|
|
207
206
|
|