vector2dggs 0.5.4__py3-none-any.whl → 0.6.0__py3-none-any.whl
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/__init__.py +1 -1
- vector2dggs/h3.py +28 -5
- {vector2dggs-0.5.4.dist-info → vector2dggs-0.6.0.dist-info}/METADATA +7 -7
- vector2dggs-0.6.0.dist-info/RECORD +10 -0
- {vector2dggs-0.5.4.dist-info → vector2dggs-0.6.0.dist-info}/WHEEL +1 -1
- vector2dggs-0.5.4.dist-info/RECORD +0 -10
- {vector2dggs-0.5.4.dist-info → vector2dggs-0.6.0.dist-info}/COPYING +0 -0
- {vector2dggs-0.5.4.dist-info → vector2dggs-0.6.0.dist-info}/COPYING.LESSER +0 -0
- {vector2dggs-0.5.4.dist-info → vector2dggs-0.6.0.dist-info}/entry_points.txt +0 -0
vector2dggs/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__: str = "0.
|
1
|
+
__version__: str = "0.6.0"
|
vector2dggs/h3.py
CHANGED
@@ -69,18 +69,40 @@ def polyfill(
|
|
69
69
|
output_directory: str,
|
70
70
|
) -> None:
|
71
71
|
"""
|
72
|
-
Reads a geoparquet, performs H3 polyfilling,
|
73
|
-
and writes out to parquet.
|
72
|
+
Reads a geoparquet, performs H3 polyfilling (for polygons),
|
73
|
+
linetracing (for linestrings), and writes out to parquet.
|
74
74
|
"""
|
75
75
|
df = gpd.read_parquet(pq_in).reset_index().drop(columns=[spatial_sort_col])
|
76
76
|
if len(df.index) == 0:
|
77
77
|
# Input is empty, nothing to polyfill
|
78
78
|
return None
|
79
|
-
|
79
|
+
|
80
|
+
df_polygon = df[df.geom_type == "Polygon"]
|
81
|
+
if len(df_polygon.index) > 0:
|
82
|
+
df_polygon = df_polygon.h3.polyfill_resample(
|
83
|
+
resolution, return_geometry=False
|
84
|
+
).drop(columns=["index"])
|
85
|
+
|
86
|
+
df_linestring = df[df.geom_type == "LineString"]
|
87
|
+
if len(df_linestring.index) > 0:
|
88
|
+
df_linestring = (
|
89
|
+
df_linestring.h3.linetrace(resolution)
|
90
|
+
.explode("h3_linetrace")
|
91
|
+
.set_index("h3_linetrace")
|
92
|
+
)
|
93
|
+
df_linestring = df_linestring[~df_linestring.index.duplicated(keep="first")]
|
94
|
+
|
95
|
+
df = pd.concat(
|
96
|
+
map(
|
97
|
+
lambda _df: pd.DataFrame(_df.drop(columns=[_df.geometry.name])),
|
98
|
+
[df_polygon, df_linestring],
|
99
|
+
)
|
100
|
+
)
|
101
|
+
|
80
102
|
if len(df.index) == 0:
|
81
103
|
# Polyfill resulted in empty output (e.g. large cell, small feature)
|
82
104
|
return None
|
83
|
-
|
105
|
+
|
84
106
|
df.index.rename(f"h3_{resolution:02}", inplace=True)
|
85
107
|
parent_res: int = _get_parent_res(parent_res, resolution)
|
86
108
|
# Secondary (parent) H3 index, used later for partitioning
|
@@ -218,7 +240,8 @@ def _index(
|
|
218
240
|
{
|
219
241
|
"index": lambda frame: frame[
|
220
242
|
(frame.geometry.geom_type != "Polygon")
|
221
|
-
|
243
|
+
& (frame.geometry.geom_type != "LineString")
|
244
|
+
], # NB currently points and other types are lost; in principle, these could be indexed
|
222
245
|
"message": "Dropping non-polygonal geometries",
|
223
246
|
},
|
224
247
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: vector2dggs
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.0
|
4
4
|
Summary: CLI DGGS indexer for vector geospatial data
|
5
5
|
Home-page: https://github.com/manaakiwhenua/vector2dggs
|
6
6
|
License: LGPL-3.0-or-later
|
@@ -21,12 +21,12 @@ Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
21
21
|
Requires-Dist: click-log (>=0.4.0,<0.5.0)
|
22
22
|
Requires-Dist: dask (>=2023.3.0,<2024.0.0)
|
23
23
|
Requires-Dist: dask-geopandas (>=0.3.0,<0.4.0)
|
24
|
-
Requires-Dist: gdal (>=3.
|
24
|
+
Requires-Dist: gdal (>=3.8.0,<4.0.0)
|
25
25
|
Requires-Dist: geopandas (>=0.12.2,<0.13.0)
|
26
|
-
Requires-Dist: h3pandas (>=0.2.
|
26
|
+
Requires-Dist: h3pandas (>=0.2.6,<0.3.0)
|
27
27
|
Requires-Dist: psycopg2 (>=2.9.6,<3.0.0)
|
28
|
-
Requires-Dist: pyarrow (>=
|
29
|
-
Requires-Dist: pygeos (>=0.
|
28
|
+
Requires-Dist: pyarrow (>=14.0.1,<15.0.0)
|
29
|
+
Requires-Dist: pygeos (>=0.13,<0.14)
|
30
30
|
Requires-Dist: pyproj (>=3.5.0,<4.0.0)
|
31
31
|
Requires-Dist: sqlalchemy (>=2.0.10,<3.0.0)
|
32
32
|
Requires-Dist: tqdm (>=4.65.0,<5.0.0)
|
@@ -187,14 +187,14 @@ vector2dggs h3 -v DEBUG -id ogc_fid -r 9 -p 5 -t 4 --overwrite -tbl topo50_lake
|
|
187
187
|
title={{vector2dggs}},
|
188
188
|
author={Ardo, James and Law, Richard},
|
189
189
|
url={https://github.com/manaakiwhenua/vector2dggs},
|
190
|
-
version={0.
|
190
|
+
version={0.6.0},
|
191
191
|
date={2023-04-20}
|
192
192
|
}
|
193
193
|
```
|
194
194
|
|
195
195
|
APA/Harvard
|
196
196
|
|
197
|
-
> Ardo, J., & Law, R. (2023). vector2dggs (0.
|
197
|
+
> Ardo, J., & Law, R. (2023). vector2dggs (0.6.0) [Computer software]. https://github.com/manaakiwhenua/vector2dggs
|
198
198
|
|
199
199
|
[](https://github.com/manaakiwhenua/manaakiwhenua-standards)
|
200
200
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
vector2dggs/__init__.py,sha256=8xTECrwGH36hEfgoQ2Zcq4dfigWVZmIFK3OHqNOg-FQ,27
|
2
|
+
vector2dggs/cli.py,sha256=tL4NJ99uQsqoVinwYadna1a4ko5v2sdZaFaeDAj6QNE,599
|
3
|
+
vector2dggs/h3.py,sha256=kX3S630l-LOm04pe5YT-5g99DIV0t32GFYUEs0Hc5ZQ,14354
|
4
|
+
vector2dggs/katana.py,sha256=xx5R9lDuraWLK5bfGkiDQDC2r2naj_sKZlYeB52_xwc,3320
|
5
|
+
vector2dggs-0.6.0.dist-info/entry_points.txt,sha256=5h8LB9L2oOE5u_N7FRGtu4JDwa553iPs4u0XhcLeLZU,52
|
6
|
+
vector2dggs-0.6.0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
7
|
+
vector2dggs-0.6.0.dist-info/METADATA,sha256=d8dvx5_wXFO-ZMKcdXmc2TuXQv5B5UFRo1hq4fghe8w,9777
|
8
|
+
vector2dggs-0.6.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
9
|
+
vector2dggs-0.6.0.dist-info/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
10
|
+
vector2dggs-0.6.0.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
vector2dggs/__init__.py,sha256=k2mVhGfDpsy8Z1zpD4DDxkUDrEoNwp3wetuIS9B8ioQ,27
|
2
|
-
vector2dggs/cli.py,sha256=tL4NJ99uQsqoVinwYadna1a4ko5v2sdZaFaeDAj6QNE,599
|
3
|
-
vector2dggs/h3.py,sha256=Ye9YS9G1HEnoSm9pnXVTUZClC5FpGaUGmIXtZWvk7bw,13646
|
4
|
-
vector2dggs/katana.py,sha256=xx5R9lDuraWLK5bfGkiDQDC2r2naj_sKZlYeB52_xwc,3320
|
5
|
-
vector2dggs-0.5.4.dist-info/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
6
|
-
vector2dggs-0.5.4.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
7
|
-
vector2dggs-0.5.4.dist-info/METADATA,sha256=X7yb_cHG7RUx_hCh4VwuUL5wlcQeGvxxmz2w3URXiKE,9777
|
8
|
-
vector2dggs-0.5.4.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
9
|
-
vector2dggs-0.5.4.dist-info/entry_points.txt,sha256=5h8LB9L2oOE5u_N7FRGtu4JDwa553iPs4u0XhcLeLZU,52
|
10
|
-
vector2dggs-0.5.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|