rusterize 0.1.1__cp310-abi3-win_amd64.whl → 0.2.0__cp310-abi3-win_amd64.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.
Potentially problematic release.
This version of rusterize might be problematic. Click here for more details.
- rusterize/rusterize.pyd +0 -0
- {rusterize-0.1.1.dist-info → rusterize-0.2.0.dist-info}/METADATA +15 -15
- rusterize-0.2.0.dist-info/RECORD +7 -0
- {rusterize-0.1.1.dist-info → rusterize-0.2.0.dist-info}/WHEEL +1 -1
- rusterize-0.1.1.dist-info/RECORD +0 -7
- {rusterize-0.1.1.dist-info → rusterize-0.2.0.dist-info}/licenses/LICENSE +0 -0
rusterize/rusterize.pyd
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rusterize
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
|
5
5
|
Classifier: Operating System :: OS Independent
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -22,13 +22,10 @@ Project-URL: repository, https://github.com/ttrotto/rusterize
|
|
|
22
22
|
# rusterize
|
|
23
23
|
|
|
24
24
|
High performance rasterization tool for Python built in Rust. This
|
|
25
|
-
repository
|
|
26
|
-
for R
|
|
25
|
+
repository stems from the [fasterize](https://github.com/ecohealthalliance/fasterize.git) package built in C++
|
|
26
|
+
for R and ports parts of the logics into Python with a Rust backend, in addition to some useful improvements.
|
|
27
27
|
|
|
28
|
-
Functionally, it takes an input [geopandas](https://geopandas.org/en/stable/)
|
|
29
|
-
dataframes and returns a [xarray](https://docs.xarray.dev/en/stable/). It
|
|
30
|
-
tighly mirrors the processing routine of fasterize, so it works only on
|
|
31
|
-
(multi)polygon geometries at the moment.
|
|
28
|
+
**rusterize** is designed to work on *(multi)polygons* and *(multi)linestrings*. Functionally, it takes an input [geopandas](https://geopandas.org/en/stable/) dataframe and returns a [xarray](https://docs.xarray.dev/en/stable/).
|
|
32
29
|
|
|
33
30
|
# Installation
|
|
34
31
|
|
|
@@ -68,7 +65,7 @@ This function has a simple API:
|
|
|
68
65
|
``` python
|
|
69
66
|
from rusterize.core import rusterize
|
|
70
67
|
|
|
71
|
-
# gdf = <import
|
|
68
|
+
# gdf = <import/modify dataframe as needed>
|
|
72
69
|
|
|
73
70
|
# rusterize
|
|
74
71
|
rusterize(gdf,
|
|
@@ -87,7 +84,7 @@ rusterize(gdf,
|
|
|
87
84
|
- `extent`: tuple of (xmin, ymin, xmax, ymax) for desired output extent
|
|
88
85
|
- `field`: field to rasterize. Default is None (a value of `1` is rasterized).
|
|
89
86
|
- `by`: column to rasterize. Assigns each group to a band in the
|
|
90
|
-
stack. Values are taken from `field`. Default is None
|
|
87
|
+
stack. Values are taken from `field`. Default is None (singleband raster)
|
|
91
88
|
- `fun`: pixel function to use when multiple values overlap. Default is
|
|
92
89
|
`last`. Available options are `sum`, `first`, `last`, `min`, `max`, `count`, or `any`
|
|
93
90
|
- `background`: background value in final raster. Default is None (NaN)
|
|
@@ -111,17 +108,18 @@ from shapely import wkt
|
|
|
111
108
|
import matplotlib.pyplot as plt
|
|
112
109
|
|
|
113
110
|
# example from fasterize
|
|
114
|
-
|
|
111
|
+
geoms = [
|
|
115
112
|
"POLYGON ((-180 -20, -140 55, 10 0, -140 -60, -180 -20), (-150 -20, -100 -10, -110 20, -150 -20))",
|
|
116
113
|
"POLYGON ((-10 0, 140 60, 160 0, 140 -55, -10 0))",
|
|
117
|
-
"POLYGON ((-125 0, 0 60, 40 5, 15 -45, -125 0))"
|
|
114
|
+
"POLYGON ((-125 0, 0 60, 40 5, 15 -45, -125 0))",
|
|
115
|
+
"MULTILINESTRING ((-180 -70, -140 -50), (-140 -50, -100 -70), (-100 -70, -60 -50), (-60 -50, -20 -70), (-20 -70, 20 -50), (20 -50, 60 -70), (60 -70, 100 -50), (100 -50, 140 -70), (140 -70, 180 -50))"
|
|
118
116
|
]
|
|
119
117
|
|
|
120
118
|
# Convert WKT strings to Shapely geometries
|
|
121
|
-
geometries = [wkt.loads(
|
|
119
|
+
geometries = [wkt.loads(geom) for geom in geoms]
|
|
122
120
|
|
|
123
121
|
# Create a GeoDataFrame
|
|
124
|
-
gdf = gpd.GeoDataFrame({'value': range(1, len(
|
|
122
|
+
gdf = gpd.GeoDataFrame({'value': range(1, len(geoms) + 1)}, geometry=geometries, crs='EPSG:32619')
|
|
125
123
|
|
|
126
124
|
# rusterize
|
|
127
125
|
output = rusterize(
|
|
@@ -230,14 +228,16 @@ Unit: seconds
|
|
|
230
228
|
fasterize 62.12409 72.13832 74.53424 75.12375 77.72899 84.77415 20
|
|
231
229
|
```
|
|
232
230
|
|
|
231
|
+
In terms of (multi)line rasterization speed, here's a benchmark against `gdal_rasterize` using a layer from the province of Quebec, Canada, representing water courses for a total of ~4.5 million multilinestrings.
|
|
232
|
+
|
|
233
233
|
# Comparison with other tools
|
|
234
234
|
|
|
235
|
-
While
|
|
235
|
+
While **rusterize** is fast, there are other fast alternatives out there, including:
|
|
236
236
|
- `GDAL`
|
|
237
237
|
- `rasterio`
|
|
238
238
|
- `geocube`
|
|
239
239
|
|
|
240
|
-
However,
|
|
240
|
+
However, **rusterize** allows for a seamless, Rust-native processing with similar or lower memory footprint that doesn't require you to leave Python, and returns the geoinformation you need for downstream processing with ample control over resolution, shape, and extent.
|
|
241
241
|
|
|
242
242
|
The following is a time comparison run on a dataset with 340K+ geometries, rasterized at 2m resolution.
|
|
243
243
|
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
rusterize-0.2.0.dist-info/METADATA,sha256=8dFN_vRKb5od7LaxK7rqt_OOEN255HwPQLjY8-X3gKQ,9262
|
|
2
|
+
rusterize-0.2.0.dist-info/WHEEL,sha256=GbZa854Nd4wq8FJ_cHwge55xWx0Hgf1aqY1IVa8I2To,95
|
|
3
|
+
rusterize-0.2.0.dist-info/licenses/LICENSE,sha256=FXkix0amECHul0Y2qWBXnEGNV2fd8GuVCIZuuzQwR-c,1130
|
|
4
|
+
rusterize/core.py,sha256=er6LErtR_utPazGm4bRYz0zF7Z6iwngizp497k_o7rM,4680
|
|
5
|
+
rusterize/__init__.py,sha256=rQSJ7V7ykrsuWz-cQK5Dm9E7usCYmCD3dIUrnosWABc,105
|
|
6
|
+
rusterize/rusterize.pyd,sha256=woTGmaJPbdNh2WQk-l_v_8nfORJGGwXBzvpg3sRtlvs,37782016
|
|
7
|
+
rusterize-0.2.0.dist-info/RECORD,,
|
rusterize-0.1.1.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
rusterize-0.1.1.dist-info/METADATA,sha256=lL69wIF4RQAsIDCDtVqSaEZ34Cw7T48hN9K8cFVnmW8,8797
|
|
2
|
-
rusterize-0.1.1.dist-info/WHEEL,sha256=md9qofgGs0CN4-5nDhVd0IzxxzM8cFGCnkeRThUNGbI,95
|
|
3
|
-
rusterize-0.1.1.dist-info/licenses/LICENSE,sha256=FXkix0amECHul0Y2qWBXnEGNV2fd8GuVCIZuuzQwR-c,1130
|
|
4
|
-
rusterize/core.py,sha256=er6LErtR_utPazGm4bRYz0zF7Z6iwngizp497k_o7rM,4680
|
|
5
|
-
rusterize/__init__.py,sha256=rQSJ7V7ykrsuWz-cQK5Dm9E7usCYmCD3dIUrnosWABc,105
|
|
6
|
-
rusterize/rusterize.pyd,sha256=BcrTx2oclD45gA7QCrsHcSMVJn3lZbYy0W3_vJTz4iU,37776384
|
|
7
|
-
rusterize-0.1.1.dist-info/RECORD,,
|
|
File without changes
|