[v0.21.0] pyogrio generator#314
Merged
Merged
Conversation
Owner
Author
|
With $ uv run scripts/bench_engines.py 500000
Generating 500,000 random point features over slope.tif …
Wrote 65.7 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmpxsrljdmu.geojson
fiona : 4.539s (110,158 feat/s)
pyogrio: 22.134s (22,590 feat/s)
fiona is 4.88x faster |
Owner
Author
|
with recent changes: $ uv run scripts/bench_engines.py 500000
Generating 500,000 random point features over slope.tif …
Wrote 65.7 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmpgmt3f3bx.geojson
fiona : 4.514s (110,767 feat/s)
/Users/matthew/projects/python-rasterstats/.venv/lib/python3.14/site-packages/pyogrio/raw.py:198:
RuntimeWarning: driver GeoJSON does not support open option USE_ARROW
return ogr_read(
pyogrio: 10.205s (48,997 feat/s)
fiona is 2.26x faster |
Owner
Author
|
Now we're getting somewhere... uv run scripts/bench_engines.py 500000
Generating 500,000 random point features over slope.tif …
Wrote GeoJSON 65.7 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmp4dg3z8wh.geojson
Converting to GeoPackage via ogr2ogr …
Wrote GeoPackage 44.9 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmpwn09reve.gpkg
=== GeoJSON ===
fiona : 4.635s (107,868 feat/s)
pyogrio: 10.397s (48,089 feat/s)
fiona is 2.24x faster (GeoJSON)
=== GeoPackage ===
fiona : 2.858s (174,936 feat/s)
pyogrio: 2.050s (243,951 feat/s)
pyogrio is 1.39x faster (GeoPackage)Some formats get faster, some slower... |
Owner
Author
|
Owner
Author
|
Owner
Author
|
The latest benchmark, fiona and pyogrio are working. The pyogrio generator is now performing well enough for me to use it as the default! uv run scripts/bench_engines.py
Generating 100,000 random point features over slope.tif …
Wrote GeoJSON 13.1 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmp_brzukhr.geojson
Converting to GeoPackage via ogr2ogr …
Wrote GeoPackage 9.0 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmp7ptsired.gpkg
Converting to Shapefile via ogr2ogr …
Wrote Shapefile 4.4 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmpa_uol1xl
Converting to FlatGeobuf via ogr2ogr …
Wrote FlatGeobuf 11.7 MB → /var/folders/17/gt7fm_5j065bkp6_k04zfrn00000gn/T/tmp2amhqcij.fgb
=== GeoJSON ===
fiona : 0.939s (106,504 feat/s)
pyogrio: 1.054s (94,915 feat/s)
fiona is 1.12x faster (GeoJSON)
=== GeoPackage ===
fiona : 0.553s (180,951 feat/s)
pyogrio: 0.416s (240,482 feat/s)
pyogrio is 1.33x faster (GeoPackage)
=== Shapefile ===
fiona : 0.654s (153,016 feat/s)
pyogrio: 0.441s (226,957 feat/s)
pyogrio is 1.48x faster (Shapefile)
=== FlatGeobuf ===
fiona : skip
pyogrio: 0.440s (227,337 feat/s)As the file size gets larger, pyogrio's advantage grows for most binary formats. For GeoJSON however, the opposite is true; large GeoJSON files get progressively slower with pyogrio. This is a fair tradeoff IMO - the assumption is that if you have large performance-sensitive data, you probably won't be using GeoJSON anyway. |
perrygeo
commented
May 22, 2026
perrygeo
commented
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fionais a great library that worked well with our records-based iteration approach. However, recent releases don't have a Python 3.14 binary wheel which complicates installation for many users. Additionally several projects, notably geopandas, are switching topyogriofor bulk loading performance.This PR implements
pyogrioas the default rasterstats engine.pip install rasterstatswill includepyogrioby defaultpip install rasterstats[fiona]will let you specify theengine=fionaparameter if you need to keep the old behavior.engine=fionaif you absolutely must get top performance out of very large 50MB+ GeoJSONs.