Package: sf 1.0-20

Edzer Pebesma

sf: Simple Features for R

Support for simple feature access, a standardized way to encode and analyze spatial vector data. Binds to 'GDAL' <doi:10.5281/zenodo.5884351> for reading and writing data, to 'GEOS' <doi:10.5281/zenodo.11396894> for geometrical operations, and to 'PROJ' <doi:10.5281/zenodo.5884394> for projection conversions and datum transformations. Uses by default the 's2' package for geometry operations on geodetic (long/lat degree) coordinates.

Authors:Edzer Pebesma [aut, cre], Roger Bivand [ctb], Etienne Racine [ctb], Michael Sumner [ctb], Ian Cook [ctb], Tim Keitt [ctb], Robin Lovelace [ctb], Hadley Wickham [ctb], Jeroen Ooms [ctb], Kirill Müller [ctb], Thomas Lin Pedersen [ctb], Dan Baston [ctb], Dewey Dunnington [ctb]

sf_1.0-20.tar.gz
sf_1.0-20.zip(r-4.5)sf_1.0-20.zip(r-4.4)sf_1.0-20.zip(r-4.3)
sf_1.0-20.tgz(r-4.4-x86_64)sf_1.0-20.tgz(r-4.4-arm64)sf_1.0-20.tgz(r-4.3-x86_64)sf_1.0-20.tgz(r-4.3-arm64)
sf_1.0-20.tar.gz(r-4.5-noble)sf_1.0-20.tar.gz(r-4.4-noble)
sf_1.0-20.tgz(r-4.4-emscripten)sf_1.0-20.tgz(r-4.3-emscripten)
sf.pdf |sf.html
sf/json (API)
NEWS

# Install 'sf' in R:
install.packages('sf', repos = c('https://r-spatial.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/r-spatial/sf/issues

Pkgdown site:https://r-spatial.github.io

Uses libs:
  • proj– Cartographic projection library
  • gdal– Geospatial Data Abstraction Library
  • geos– Geometry engine for Geographic Information Systems
  • c++– GNU Standard C++ Library v3

On CRAN:

gdalgeosprojspatialcpp

22.25 score 1.4k stars 1.1k packages 110k scripts 361k downloads 125 mentions 161 exports 12 dependencies

Last updated 6 hours agofrom:1b0e9d8af3. Checks:9 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKJan 19 2025
R-4.5-win-x86_64OKJan 19 2025
R-4.5-linux-x86_64OKJan 19 2025
R-4.4-win-x86_64OKJan 19 2025
R-4.4-mac-x86_64OKJan 19 2025
R-4.4-mac-aarch64OKJan 19 2025
R-4.3-win-x86_64OKJan 19 2025
R-4.3-mac-x86_64OKJan 19 2025
R-4.3-mac-aarch64OKJan 19 2025

Exports:.degAxis.get_layout.image_scale.image_scale_factor.stop_geos%>%as_SpatialdbDataTypedbWriteTableFULL_bbox_gdal_addogdal_creategdal_crsgdal_extractgdal_inv_geotransformgdal_metadatagdal_polygonizegdal_rasterizegdal_readgdal_read_mdimgdal_subdatasetsgdal_utilsgdal_writegdal_write_mdimget_key_posNA_agr_NA_bbox_NA_crs_NA_m_range_NA_z_range_plot_sfrawToHexread_sfsf_add_proj_unitssf_extSoftVersionsf_proj_infosf_proj_networksf_proj_pipelinessf_proj_search_pathssf_projectsf_use_s2sf.colorsst_agrst_agr<-st_areast_as_binaryst_as_grobst_as_s2st_as_sfst_as_sfcst_as_textst_axis_orderst_bboxst_bind_colsst_boundaryst_break_antimeridianst_bufferst_can_transformst_castst_centroidst_collection_extractst_combinest_concave_hullst_containsst_contains_properlyst_convex_hullst_coordinatesst_covered_byst_coversst_cropst_crossesst_crsst_crs<-st_deletest_differencest_dimensionst_disjointst_distancest_driversst_drop_geometryst_equalsst_equals_exactst_exterior_ringst_filterst_geometryst_geometry_typest_geometry<-st_geometrycollectionst_graticulest_inscribed_circlest_interpolate_awst_intersectionst_intersectsst_isst_is_emptyst_is_fullst_is_longlatst_is_simplest_is_validst_is_within_distancest_jitterst_joinst_layersst_lengthst_line_interpolatest_line_mergest_line_projectst_line_samplest_linestringst_m_rangest_make_gridst_make_validst_minimum_bounding_circlest_minimum_rotated_rectanglest_multilinestringst_multipointst_multipolygonst_nearest_featurest_nearest_pointsst_nodest_normalizest_overlapsst_perimeterst_pointst_point_on_surfacest_polygonst_polygonizest_precisionst_precision<-st_readst_read_dbst_relatest_reversest_samplest_segmentizest_set_agrst_set_crsst_set_geometryst_set_precisionst_sfst_sfcst_shift_longitudest_simplifyst_snapst_sym_differencest_touchesst_transformst_triangulatest_triangulate_constrainedst_unionst_viewportst_voronoist_withinst_wrap_datelinest_writest_write_dbst_z_rangest_zmvec_cast.sfcvec_ptype2.sfcwrite_sf

Dependencies:classclassIntDBIe1071KernSmoothmagrittrMASSproxyRcpps2unitswk

Simple Features for R

Rendered fromsf1.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-11-22
Started: 2016-11-12

Reading, Writing and Converting Simple Features

Rendered fromsf2.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-09-05
Started: 2016-11-12

Manipulating Simple Feature Geometries

Rendered fromsf3.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-01-30
Started: 2016-11-14

Manipulating Simple Features

Rendered fromsf4.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-01-30
Started: 2017-07-23

Plotting Simple Features

Rendered fromsf5.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-01-30
Started: 2017-10-28

Miscellaneous

Rendered fromsf6.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2024-02-08
Started: 2017-10-29

Spherical geometry in sf using s2geometry

Rendered fromsf7.Rmdusingknitr::rmarkdownon Jan 19 2025.

Last update: 2025-01-10
Started: 2020-07-12

Readme and manuals

Help Manual

Help pageTopics
aggregate an 'sf' objectaggregate aggregate.sf
Methods to coerce simple features to Spatial* and 'Spatial*DataFrame' objectsas as_Spatial coerce crs CRS-method sf-method sfc-method Spatial Spatial-method
Bind rows (features) of sf objectsbind cbind.sf rbind.sf st_bind_cols
Drivers for which update should be 'TRUE' by defaultdb_drivers
Determine database type for R vectordbDataType,DBIObject,sf-method dbDataType,PostgreSQLConnection,sf-method
Write 'sf' object to DatabasedbWriteTable,DBIObject,character,sf-method dbWriteTable,PostgreSQLConnection,character,sf-method
Map extension to driverextension_map
Add or remove overviews to/from a raster imagegdal_addo
Native interface to gdal utilsgdal_utils
Geometric operations on pairs of simple feature geometry setsgeos_binary_ops st_difference st_difference.sfc st_intersection st_intersection.sf st_intersection.sfc st_snap st_sym_difference
Geometric binary predicates on pairs of simple feature geometry setsgeos_binary_pred st_contains st_contains_properly st_covered_by st_covers st_crosses st_disjoint st_equals st_equals_exact st_intersects st_is_within_distance st_overlaps st_touches st_within
Combine or union feature geometriesgeos_combine st_combine st_union
Compute geometric measurementsgeos_measures st_area st_area.sfc st_distance st_length st_perimeter
Dimension, simplicity, validity or is_empty queries on simple feature geometriesgeos_query st_dimension st_is_empty st_is_simple
Geometric unary operations on simple feature geometry setsgeos_unary st_boundary st_buffer st_centroid st_concave_hull st_convex_hull st_exterior_ring st_inscribed_circle st_line_merge st_minimum_bounding_circle st_minimum_rotated_rectangle st_node st_point_on_surface st_polygonize st_reverse st_segmentize st_simplify st_triangulate st_triangulate_constrained st_voronoi
Areal-weighted interpolation of polygon datainterpolate_aw st_interpolate_aw st_interpolate_aw.sf
Check if driver is availableis_driver_available
Check if a driver can perform an actionis_driver_can
Check if the columns could be of a coercable type for sfis_geometry_column
merge method for sf and data.frame objectmerge.sf
North Carolina SIDS datanc
Arithmetic operators for simple feature geometriesOps Ops.sfc Ops.sfg
plot sf objectget_key_pos plot plot.sf plot.sfc_CIRCULARSTRING plot.sfc_GEOMETRY plot.sfc_GEOMETRYCOLLECTION plot.sfc_LINESTRING plot.sfc_MULTILINESTRING plot.sfc_MULTIPOINT plot.sfc_MULTIPOLYGON plot.sfc_POINT plot.sfc_POLYGON plot.sfg plot_sf points.sf points.sfc sf.colors text.sf text.sfc
Map prefix to driverprefix_map
Manage PROJ settingsproj_tools sf_proj_network sf_proj_pipelines sf_proj_search_paths
Convert raw vector(s) into hexadecimal character string(s)rawToHex
functions for spherical geometry, using s2 packages2 sf_use_s2 st_as_s2 st_as_s2.sf st_as_s2.sfc
Create sf objectprint.sf sf st_sf [.sf
Provide the external dependencies versions of the libraries linked to sfsf_extSoftVersion
directly transform a set of coordinatessf_add_proj_units sf_project
Create simple feature geometry list columnsfc sfc_GEOMETRYCOLLECTION sfc_LINESTRING sfc_MULTILINESTRING sfc_MULTIPOINT sfc_MULTIPOLYGON sfc_POINT sfc_POLYGON st_sfc [.sfc
Methods for dealing with sparse geometry binary predicate listsas.data.frame.sgbp as.matrix.sgbp dim.sgbp Ops.sgbp print.sgbp sgbp t.sgbp
Create simple feature from a numeric vector, matrix or listas.matrix.sfg c.sfg format.sfg head.sfg print.sfg st st_geometrycollection st_linestring st_multilinestring st_multipoint st_multipolygon st_point st_polygon
get or set relation_to_geometry attribute of an 'sf' objectNA_agr_ st_agr st_agr<- st_set_agr
Convert sfc object to an WKB objectst_as_binary st_as_binary.sfc st_as_binary.sfg
Convert sf* object to a grobst_as_grob
Convert foreign object to an sf objectst_as_sf st_as_sf.data.frame st_as_sf.lpp st_as_sf.map st_as_sf.ppp st_as_sf.psp st_as_sf.s2_geography st_as_sf.sf st_as_sf.sfc st_as_sf.Spatial
Convert foreign geometry object to an sfc objectst_as_sfc st_as_sfc.bbox st_as_sfc.blob st_as_sfc.character st_as_sfc.factor st_as_sfc.list st_as_sfc.map st_as_sfc.pq_geometry st_as_sfc.raw st_as_sfc.s2_geography st_as_sfc.SpatialLines st_as_sfc.SpatialMultiPoints st_as_sfc.SpatialPixels st_as_sfc.SpatialPoints st_as_sfc.SpatialPolygons st_as_sfc.WKB
Return Well-known Text representation of simple feature geometry or coordinate reference systemst_as_text st_as_text.crs st_as_text.sfc st_as_text.sfg
Return bounding of a simple feature or simple feature setformat.bbox FULL_bbox_ is.na.bbox NA_bbox_ st_bbox st_bbox.CIRCULARSTRING st_bbox.COMPOUNDCURVE st_bbox.CURVEPOLYGON st_bbox.Extent st_bbox.GEOMETRYCOLLECTION st_bbox.LINESTRING st_bbox.MULTICURVE st_bbox.MULTILINESTRING st_bbox.MULTIPOINT st_bbox.MULTIPOLYGON st_bbox.MULTISURFACE st_bbox.numeric st_bbox.POINT st_bbox.POLYGON st_bbox.POLYHEDRALSURFACE st_bbox.Raster st_bbox.sf st_bbox.sfc st_bbox.Spatial st_bbox.TIN st_bbox.TRIANGLE
Break antimeridian for plotting not centred on Greenwichst_break_antimeridian st_break_antimeridian.sf st_break_antimeridian.sfc
Cast geometry to another type: either simplify, or cast explicitlyst_cast st_cast.CIRCULARSTRING st_cast.COMPOUNDCURVE st_cast.CURVE st_cast.GEOMETRYCOLLECTION st_cast.LINESTRING st_cast.MULTICURVE st_cast.MULTILINESTRING st_cast.MULTIPOINT st_cast.MULTIPOLYGON st_cast.MULTISURFACE st_cast.POINT st_cast.POLYGON st_cast.sf st_cast.sfc st_cast.sfc_CIRCULARSTRING
Coerce geometry to MULTI* geometryst_cast_sfc_default
Given an object with geometries of type 'GEOMETRY' or 'GEOMETRYCOLLECTION', return an object consisting only of elements of the specified type.st_collection_extract st_collection_extract.sf st_collection_extract.sfc st_collection_extract.sfg
retrieve coordinates in matrix formst_coordinates
crop an sf object to a specific rectanglest_crop st_crop.sf st_crop.sfc
Retrieve coordinate reference system from object$.crs format.crs is.na.crs NA_crs_ st_axis_order st_crs st_crs.bbox st_crs.character st_crs.CRS st_crs.crs st_crs.numeric st_crs.sf st_crs.sfc st_crs<- st_crs<-.sf st_crs<-.sfc st_set_crs
Get GDAL driversst_drivers
Get, set, replace or rename geometry from an sf objectst_drop_geometry st_drop_geometry.default st_drop_geometry.sf st_geometry st_geometry.sf st_geometry.sfc st_geometry.sfg st_geometry<- st_set_geometry
Return geometry type of an objectst_geometry_type
Compute graticules and their parametersst_graticule
test equality between the geometry type and a class or set of classesst_is
predicate whether a geometry is equal to a POLYGON FULLst_is_full st_is_full.bbox st_is_full.sf st_is_full.sfc st_is_full.sfg
Assert whether simple feature coordinates are longlat degreesst_is_longlat
jitter geometriesst_jitter
spatial join, spatial filterst_filter st_filter.sf st_join st_join.sf
Return properties of layers in a datasourcest_layers
Project point on linestring, interpolate along a linestringst_line_interpolate st_line_project st_line_project_point
Sample points on a linear geometryst_line_sample
Return 'm' range of a simple feature or simple feature setis.na.m_range NA_m_range_ st_m_range st_m_range.CIRCULARSTRING st_m_range.COMPOUNDCURVE st_m_range.CURVEPOLYGON st_m_range.GEOMETRYCOLLECTION st_m_range.LINESTRING st_m_range.MULTICURVE st_m_range.MULTILINESTRING st_m_range.MULTIPOINT st_m_range.MULTIPOLYGON st_m_range.MULTISURFACE st_m_range.numeric st_m_range.POINT st_m_range.POLYGON st_m_range.POLYHEDRALSURFACE st_m_range.sf st_m_range.sfc st_m_range.TIN st_m_range.TRIANGLE
Create a regular tesselation over the bounding box of an sf or sfc objectst_make_grid
get index of nearest featurest_nearest_feature
get nearest points between pairs of geometriesst_nearest_points st_nearest_points.sf st_nearest_points.sfc st_nearest_points.sfg
Normalize simple featuresst_normalize
Get precisionst_precision st_precision<- st_set_precision
Read simple features or layers from file or databaseread_sf st_read st_read.character st_read.DBIObject
Compute DE9-IM relation between pairs of geometries, or match it to a given patternst_relate
sample points on or in (sets of) spatial featuresst_sample st_sample.bbox st_sample.sf st_sample.sfc st_sample.sfg
Shift or re-center geographical coordinates for a Pacific viewst_shift_longitude st_shift_longitude.sf st_shift_longitude.sfc
Transform or convert coordinates of simple featuresf_proj_info st_can_transform st_transform st_transform.bbox st_transform.sf st_transform.sfc st_transform.sfg st_wrap_dateline st_wrap_dateline.sf st_wrap_dateline.sfc st_wrap_dateline.sfg
Create viewport from sf, sfc or sfg objectst_viewport
Write simple features object to file or databasest_delete st_write st_write.data.frame st_write.sf st_write.sfc write_sf
Return 'z' range of a simple feature or simple feature setis.na.z_range NA_z_range_ st_z_range st_z_range.CIRCULARSTRING st_z_range.COMPOUNDCURVE st_z_range.CURVEPOLYGON st_z_range.GEOMETRYCOLLECTION st_z_range.LINESTRING st_z_range.MULTICURVE st_z_range.MULTILINESTRING st_z_range.MULTIPOINT st_z_range.MULTIPOLYGON st_z_range.MULTISURFACE st_z_range.numeric st_z_range.POINT st_z_range.POLYGON st_z_range.POLYHEDRALSURFACE st_z_range.sf st_z_range.sfc st_z_range.TIN st_z_range.TRIANGLE
Drop or add Z and/or M dimensions from feature geometriesst_zm
Summarize simple feature columnsummary.sfc
Summarize simple feature type for tibbleobj_sum.sfc pillar_shaft.sfc tibble type_sum.sfc
Tidyverse methods for sf objectsanti_join.sf arrange.sf distinct.sf drop_na.sf filter.sf full_join.sf gather.sf group_by.sf group_split.sf inner_join.sf left_join.sf mutate.sf nest.sf pivot_longer.sf pivot_wider.sf rename.sf rename_with.sf right_join.sf rowwise.sf sample_frac.sf sample_n.sf select.sf semi_join.sf separate.sf separate_rows.sf slice.sf spread.sf summarise summarise.sf tidyverse transmute.sf ungroup.sf unite.sf unnest.sf
transform method for sf objectstransform.sf
Check validity or make an invalid geometry validst_is_valid st_is_valid.sf st_is_valid.sfc st_is_valid.sfg st_make_valid st_make_valid.sfc st_make_valid.sfg valid
vctrs methods for sf objectsvctrs vec_cast.sfc vec_cast.sfc.default vec_cast.sfc.sfc vec_ptype2.sfc vec_ptype2.sfc.default vec_ptype2.sfc.sfc