Repository navigation
GeoFrame 0.2.0
Like 0.1.x, it is distributed through the v0.2.0 git tag and GitHub release, not through Hex
yet. The release attaches precompiled NIFs for nine targets; they are used once GeoFrame is on
Hex, where no Rust toolchain is needed. A git dependency builds the NIF from source (a stable
Rust toolchain is required).
This release adds batched reads (stream_file/2), grouped aggregation (group_by, summarise,
group_map) and precompiled NIFs, closes a set of GeoPandas parity gaps, and makes a few
behaviours stricter or closer to GDAL and GEOS. Five changes need a look in existing code; see
Breaking changes.
Breaking changes
set_crs/3no longer overrides an existing CRS. Setting a different CRS on a series or
frame that already has one raisesArgumentError, as in GeoPandas; the same CRS is a no-op, a
missing CRS is set, andnilstill clears. Migration: to relabel on purpose, pass
allow_override: true(set_crs(gdf, "EPSG:3857", allow_override: true)); to change
coordinates, useto_crs/2.read_file(bbox:),stream_file(bbox:)and FlatGeobuf reads use GDAL's semantics: a
feature is kept when its geometry intersects the box, not when its envelope does. A diagonal
LINESTRING (0 0, 10 10)is dropped by the box6 0 9 3. Shapefile, GeoPackage and GeoJSON
gain the option with the same rule; GeoParquet keeps its covering-box semantics, as GeoPandas.
Migration: results can lose rows that only the envelope touched; if you relied on the envelope
test, filter withGeoSeries.total_boundsor an envelope intersection after reading.write_feather/3andto_arrowwrite 65 536-row record batches by default, as pyarrow
and GeoPandasto_feather, instead of one record batch per file. Migration: pass
record_batch_size:(a positive integer) to choose another size; a file with a single batch
needs a size at least as large as the frame. Existing files read the same.- On a grouped frame,
head,tail,sliceandsampleact per group (Explorer's grouped
semantics, pandasgroupby.head), keeping the original row order, with the geometry aligned.
Migration: callungroup/2first to get the old global behaviour. Ungrouped frames are
unchanged. summarisewith:n_distinctno longer counts nulls (pandasnunique). Migration: the
previous value is the new one plus one for each group whose column holds a null.
Added
- Precompiled NIFs through
rustler_precompiled: the release workflow builds
aarch64-apple-darwin,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl,
x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc,
x86_64-unknown-freebsd,x86_64-unknown-linux-gnuandx86_64-unknown-linux-musl(NIF
version 2.15) on eachv*tag and attaches them to the release. A Hex package verifies the
download against a shipped checksum file;GEOFRAME_BUILD=trueforces a source build. - A git or path dependency builds the NIF from source automatically (no
GEOFRAME_BUILD
needed), because a package without the checksum file cannot download a precompiled NIF; Rustler
is then fetched as a dependency. GeoFrame.stream_file/2: a lazyStreamofGeoDataFramebatches for GeoParquet,
FlatGeobuf, Feather / Arrow IPC, Shapefile (.shp,.zip), GeoPackage and GeoJSON, with
batch_size:(default 65 536),bbox:,columns:and format options. Concatenating the
batches equalsread_file/2; early halts release the reader. On 500 000 points with
10 000-row batches, peak memory is 155 to 196 MB against 235 to 308 MB for a whole read
(GeoJSON 72 MB: 175 MB against 637 MB).read_file(path, rows: n | first..last)for every format, as GeoPandasrows=: the firstn
rows or an inclusive range, applied afterbbox:and skipping rows cheaply where the format
allows (for examplerows: 10on a GeoParquet file: 1 ms against 239 ms).read_file(bbox:)for Shapefile, GeoPackage and GeoJSON, andrecord_batch_size:on
write_feather/to_arrow.GeoDataFrame.group_by/2,ungroup/2,groups/1andsummarise/3: attribute aggregations
(:sum :mean :median :min :max :count :first :last :n_distinct) and geometry aggregations
(:union_all :intersection_all :collect :envelope :convex_hull :centroid :first :last :count)
computed in one NIF call, 8 to 14 times faster than a per-group loop at 100 000 rows and 1 000
groups.summarise(group_by(gdf, by), [])equalsdissolve(gdf, by: by).GeoDataFrame.group_map/4(pandasgroupby(by).apply(fun)) and the top-levelGeoFrame
delegatesgroup_by/2,summarise/3,ungroup/2andgroup_map/4.sindex_query/4accepts a list of WKT strings or a single WKT string as input (a single
geometry returns the ascending tree indices, as GeoPandas) and thesort:option;
get_geometry/2takes a per-row index list or series.GeoDataFrame.from_features/2keeps the property column order for ordered input (keyword
lists,{key, value}pairs,Jason.OrderedObject);to_geo_dict/2with GeoPandas'na:,
show_bbox:anddrop_id:;GeoDataFrame.to_wkb/2(hex:,srid:),to_wkt/2and
rename_geometry/2.dissolveacceptsas_index: falseandobserved: false(unobserved categories become empty
groups);as_index: trueandlevel:raise because GeoFrame has no index. The default stays
observed: true.frechet_distanceworks on every geometry type, as GEOS, not only onLineStrings.buffer/3takes a per-row distance (a list withnil, or a series) andsingle_sided:; lines
and points match GEOS, polygons return the band, which matches GEOS only for polygons small
relative to the distance (documented indocs/parity.md).- The vertex constructors (
line_strings_from_vertices,polygons_from_rings, ...) accept
{x, y, z}and[x, y, z]vertices as Shapely 2.2. GeoFrame.Kino.deck/2: click popups (popup: true | [columns]) and several layers
(deck([gdf1, {gdf2, name: ..., color: ...}], opts)) with a layer-control panel; a single
frame sends the same payload as before.- Shapefiles and GeoPackages written with one of the 1 217 supplementary EPSG codes keep their
definition: a WKT1.prjis written and the GeoPackagedefinitionis filled, instead of a
warning andundefined. 119 codes have no WKT1 in PROJ (Krovak Modified 5515 and 5516, 3D,
geocentric and compound CRSs) and behave as before.
Changed
- A missing Z reads as 0, as GDAL: a two-value position in a 3D GeoJSON geometry, and a row
without Z written to a Shapefile or FlatGeobuf layer with Z (a storedNaNZ staysNaN). is_validis false andmake_validrepairs a polygon whose interior is disconnected, as GEOS
(Interior is disconnected): a hole touching the shell at two or more points, or a chain or
cycle of holes cutting the interior. A single touch stays valid.null_out_invalidnulls
these polygons.is_valid_reasonfollows GEOS's check order and wording (Self-intersection[2 2],
Hole lies outside shell[...],Too few points in geometry component[...], and so on).polygonizewithnode: trueand lines crossing polygons matches GEOS: no extra small face,
and the crossing point is a vertex of the merged ring. On a 2 000-case fuzz,polygonize
mismatches fell from 46 to 2 (and 54 to 3 on a second seed), with no case worse;build_area
improves too (495 to 472 and 474 to 450) but still differs from GEOS where GEOS drops collinear
vertices.
Documentation
docs/parity.mdand the README follow every change above. The reference suite is
now 19 118 cases: 18 379 agree with GeoPandas / Shapely and 739 are documented deviations,
none unexplained (0.1.1: 18 134 agree and 730 documented of 18 864).
Internal
- The release workflow uploads artifacts on pull requests that change it; the
.cargoconfig
links musl cdylibs without static CRT.
Full changelog: CHANGELOG.md