Reports the GeospatialStatistics that writers record for GEOMETRY and
GEOGRAPHY columns: each column chunk's bounding box and the geometry
types it holds. One row per row group and geospatial column, whether or not
the chunk carries them, so a reader can choose row groups by box before
reading any data. qio's own writer records them for every geospatial
column.
Usage
geospatial_statistics(x, ...)
# S3 method for class 'qio_parquet_file'
geospatial_statistics(x, ...)Value
A data frame with one row per row group and geospatial column, ordered by row group, then column, with the columns:
row_group1-based row-group ID, as
row_groups()reports it.column1-based physical column index, as
schema()reports it.pathComplete dotted column path; see
schema().xmin,xmax,ymin,ymaxThe bounding box, or
NAwhen none was recorded.zmin,zmax,mmin,mmaxThe Z and M ranges, or
NAwhen the geometries have no such dimension or none was recorded.geometry_typesA list column of the ISO WKB geometry type codes present (1 for a point, 1001 for a point with Z, ...), or
NULLwhen none were recorded, which Parquet reads as unknown.
Details
Like column_statistics(), the bounds are claims made by whoever wrote the
file. For GEOGRAPHY a box can be smaller than the geometries' extent on
the sphere, and an xmin greater than xmax means the box wraps the
antimeridian.
See also
column_statistics(), parquet_schema() for writing geospatial
columns.
Examples
path <- tempfile(fileext = ".parquet")
point <- function(x, y) {
c(as.raw(1), writeBin(1L, raw(), size = 4, endian = "little"),
writeBin(c(x, y), raw(), size = 8, endian = "little"))
}
df <- data.frame(id = 1:2)
df$geom <- list(point(1, 2), point(3, 4))
write_parquet(df, path, schema = parquet_schema(geom = "GEOMETRY"))
pf <- open_parquet(path)
geospatial_statistics(pf)
#> row_group column path xmin xmax ymin ymax zmin zmax mmin mmax geometry_types
#> 1 1 2 geom 1 3 2 4 NA NA NA NA 1
close_parquet(pf)