Title: | Extension Types for Spatial Data for Use with 'Arrow' |
Version: | 0.3.0 |
Description: | Provides extension types and conversions to between R-native object types and 'Arrow' columnar types. This includes integration among the 'arrow', 'nanoarrow', 'sf', and 'wk' packages such that spatial metadata is preserved wherever possible. Extension type implementations ensure first-class geometry data type support in the 'arrow' and 'nanoarrow' packages. |
License: | Apache License (≥ 2) |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Imports: | nanoarrow (≥ 0.5.0), wk (≥ 0.9.0) |
LinkingTo: | wk |
Config/testthat/edition: | 3 |
URL: | https://geoarrow.org/geoarrow-r/, https://github.com/geoarrow/geoarrow-r |
BugReports: | https://github.com/geoarrow/geoarrow-r/issues |
Depends: | R (≥ 3.6.0) |
Suggests: | arrow, R6, sf, testthat (≥ 3.0.0) |
SystemRequirements: | C++17 |
NeedsCompilation: | yes |
Packaged: | 2025-05-26 22:20:30 UTC; dewey |
Author: | Dewey Dunnington |
Maintainer: | Dewey Dunnington <dewey@dunnington.ca> |
Repository: | CRAN |
Date/Publication: | 2025-05-26 22:50:02 UTC |
geoarrow: Extension Types for Spatial Data for Use with 'Arrow'
Description
Provides extension types and conversions to between R-native object types and 'Arrow' columnar types. This includes integration among the 'arrow', 'nanoarrow', 'sf', and 'wk' packages such that spatial metadata is preserved wherever possible. Extension type implementations ensure first-class geometry data type support in the 'arrow' and 'nanoarrow' packages.
Author(s)
Maintainer: Dewey Dunnington dewey@dunnington.ca (ORCID)
Other contributors:
Anthony North anthony.jl.north@gmail.com [contributor]
Apache Software Foundation dev@arrow.apache.org [copyright holder]
Ulf Adams [copyright holder]
Daniel Lemire [copyright holder]
Joao Paulo Magalhaes [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/geoarrow/geoarrow-r/issues
Convert an object to a GeoArrow array
Description
Convert an object to a GeoArrow array
Usage
as_geoarrow_array(x, ..., schema = NULL)
as_geoarrow_array_stream(x, ..., schema = NULL)
Arguments
x |
An object |
... |
Passed to S3 methods |
schema |
A geoarrow extension schema to use as the target type |
Value
Examples
as_geoarrow_array(wk::wkt("POINT (0 1)"))
GeoArrow encoded arrays as R vectors
Description
GeoArrow encoded arrays as R vectors
Usage
as_geoarrow_vctr(x, ..., schema = NULL)
Arguments
x |
An object that works with |
... |
Passed to |
schema |
An optional |
Value
A vctr of class 'geoarrow_vctr'
Examples
as_geoarrow_vctr("POINT (0 1)")
Handler/writer interface for GeoArrow arrays
Description
Handler/writer interface for GeoArrow arrays
Usage
geoarrow_handle(x, handler, size = NA_integer_)
geoarrow_writer(schema)
Arguments
x |
An object implementing |
handler |
|
size |
The number of elements in the stream or NA if unknown |
schema |
Value
-
geoarrow_handle()
: Returns the result ofhandler
-
geoarrow_writer()
: Returns a nanoarrow array
Examples
geoarrow_handle(wk::xy(1:3, 2:4), wk::wk_debug_filter())
wk::wk_handle(wk::xy(1:3, 2:4), geoarrow_writer(na_extension_wkt()))
Inspect a GeoArrow schema
Description
Inspect a GeoArrow schema
Usage
geoarrow_schema_parse(
schema,
extension_name = NULL,
infer_from_storage = FALSE
)
is_geoarrow_schema(schema)
as_geoarrow_schema(schema)
Arguments
schema |
|
extension_name |
An extension name to use if schema is a storage type. |
infer_from_storage |
Attempt to guess an extension name if schema is not a geoarrow extension type. |
Value
A list of parsed properties
Examples
geoarrow_schema_parse(na_extension_geoarrow("POINT"))
GeoArrow Types
Description
These functions provide GeoArrow type definitions as zero-length vectors.
Usage
geoarrow_wkb(crs = NULL, edges = "PLANAR")
geoarrow_wkt(crs = NULL, edges = "PLANAR")
geoarrow_large_wkb(crs = NULL, edges = "PLANAR")
geoarrow_large_wkt(crs = NULL, edges = "PLANAR")
geoarrow_wkb_view(crs = NULL, edges = "PLANAR")
geoarrow_wkt_view(crs = NULL, edges = "PLANAR")
geoarrow_native(
geometry_type,
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_point(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_linestring(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_polygon(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_multipoint(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_multilinestring(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_multipolygon(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
geoarrow_box(
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
Arguments
crs |
An object representing a CRS. For maximum portability,
it should implement |
edges |
One of "PLANAR" or "SPHERICAL". |
geometry_type |
One of "POINT", "LINESTRING", "POLYGON", "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON". |
dimensions |
One of "XY", "XYZ", "XYM", or "XYZM" |
coord_type |
One of "SEPARATE" or "INTERLEAVED" |
Value
Examples
geoarrow_wkb()
geoarrow_wkt()
geoarrow_point()
Infer a GeoArrow-native type from a vector
Description
Infer a GeoArrow-native type from a vector
Usage
infer_geoarrow_schema(x, ..., promote_multi = TRUE, coord_type = NULL)
Arguments
x |
An object from which to infer a schema. |
... |
Passed to S3 methods. |
promote_multi |
Use |
coord_type |
Specify the coordinate type to use if returning |
Value
Examples
infer_geoarrow_schema(wk::wkt("POINT (0 1)"))
Extension type definitions for GeoArrow extension types
Description
Extension type definitions for GeoArrow extension types
Usage
na_extension_wkb(crs = NULL, edges = "PLANAR")
na_extension_wkt(crs = NULL, edges = "PLANAR")
na_extension_large_wkb(crs = NULL, edges = "PLANAR")
na_extension_large_wkt(crs = NULL, edges = "PLANAR")
na_extension_wkb_view(crs = NULL, edges = "PLANAR")
na_extension_wkt_view(crs = NULL, edges = "PLANAR")
na_extension_geoarrow(
geometry_type,
dimensions = "XY",
coord_type = "SEPARATE",
crs = NULL,
edges = "PLANAR"
)
Arguments
crs |
An object representing a CRS. For maximum portability,
it should implement |
edges |
One of "PLANAR" or "SPHERICAL". |
geometry_type |
One of "POINT", "LINESTRING", "POLYGON", "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON". |
dimensions |
One of "XY", "XYZ", "XYM", or "XYZM" |
coord_type |
One of "SEPARATE" or "INTERLEAVED" |
Value
Examples
na_extension_wkb(crs = "OGC:CRS84")
na_extension_geoarrow("POINT")