SF Migration Guide
Construction
| definition | sf | geospark |
|---|---|---|
| Return a specified ST_Geometry value from Well-Known Text representation (WKT) | st_as_sf(df,wkt="geom") |
ST_GeomFromText |
| Returns a specified ST_Geometry value from dataframe | st_as_sf(df, coords = c("x", "y")) |
- |
| Construct a Geometry from WKB object | st_read |
ST_GeomFromWKB |
| Construct a Geometry from Geojson object | st_read |
ST_GeomFromGeojson |
| Return Well-Known Text representation (WKT) from a specified ST_Geometry value | st_as_text |
ST_As_Text |
| Returns an ST_Point with the given coordinate values. OGC alias for ST_MakePoint | st_point |
ST_Point |
| Returns a polygon built from the specified linestring and SRID | st_polygon |
- |
| Coordinate Reference System / Spatial Reference System Transformation: for exmaple, from WGS84 (EPSG:4326, degree-based), to EPSG:3857 (meter-based) | st_transform |
ST_Transform |
Geometry Measurement
| definition | sf | geospark |
|---|---|---|
| Return polygon area of a geometry | st_area |
ST_Area |
| Return line length of a geometry | st_length |
ST_Length |
| Return distance between two geomerties | st_distance |
ST_Distance |
DE9IM
| definition | sf | geospark |
|---|---|---|
| spatial join | st_join |
st_join |
| Returns TRUE if neither the two features’ boundaries intersect, nor the two elements intersect inside | st_disjoint |
ST_Disjoint |
| Returns TRUE if the only points in common between A and B lie in the union of the boundaries of A and B | st_touches |
ST_Touches |
| Returns TRUE if the given two geometry objects are "spatially cross" | st_crosses |
ST_Crosses |
| Returns TRUE if the given Geometries are "spatially equal" | st_equals |
ST_Equals |
| Returns TRUE if geometry B is completely inside geometry A | st_contains |
ST_Contains |
| Returns TRUE if geometry A is completely inside geometry B | st_within |
ST_Within |
| Returns TRUE if the Geometries "spatially overlap" | st_overlaps |
ST_Overlaps |
| Overlaps, Touches, Within all imply spatial intersection | st_intersects |
ST_Intersects |
Aggregate function
| definition | sf | geospark |
|---|---|---|
| Return the entire envelope boundary of all geometries in A | - | ST_Envelope_Aggr |
| Return the polygon union of all polygons in A | st_union |
ST_Union_Aggr |
More Advanced Operations
| definition | sf | geospark |
|---|---|---|
| Return the Convex Hull of polgyon A | st_convex_hull |
ST_ConvexHull |
| Return the envelop boundary of A | st_envelope |
ST_Envelope |
| Return the centroid point of A | st_centroid |
ST_Centroid |
| Reduce the decimals places in the coordinates of the geometry to the given number of decimal places. The last decimal place will be rounded | st_set_precision |
ST_PrecisionReduce |
| Return TRUE if geometry's only self-intersections are at boundary points | st_is_simple |
ST_IsSimple |
| Return TRUE if a geometry is well formed | st_is_valid |
ST_IsValid |
| Returns a geometry/geography that represents all points whose distance from this Geometry/geography is less than or equal to distance | st_buffer |
ST_Buffer |