g_coords: Extract coordinate values from geometries

View source: R/geom.R

g_coordsR Documentation

Extract coordinate values from geometries

Description

g_coords() extracts coordinate values (vertices) from the input geometries and returns a data frame with coordinates as columns.

Usage

g_coords(geom)

Arguments

geom

Either a raw vector of WKB or list of raw vectors, or a character vector containing one or more WKT strings.

Value

A data frame as returned by wk::wk_coords(): columns feature_id (the index of the feature from the input), part_id (an arbitrary integer identifying the point, line, or polygon from whence it came), ring_id (an arbitrary integer identifying individual rings within polygons), and one column per coordinate (x, y, and/or z and/or m).

Examples

dsn <- system.file("extdata/ynp_fires_1984_2022.gpkg", package="gdalraster")
lyr <- new(GDALVector, dsn)
d <- lyr$fetch(10)

vertices <- g_coords(d$geom)
head(vertices)

lyr$close()

gdalraster documentation built on June 8, 2025, 12:37 p.m.