Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Esri Developer

Create Esri FeatureSet Objects

These functions create an Esri FeatureSet object. A FeatureSet contains an inner arrayof features as well as additional metadata about the the collection such as thegeometry type, spatial reference, and object ID field.

Usage

as_featureset(x, crs=sf::st_crs(x), call=rlang::caller_env())as_esri_featureset(x, crs=sf::st_crs(x), call=rlang::caller_env())

Arguments

x

an object of classsf,data.frame, orsfc.

crs

the coordinate reference system. It must be interpretable bysf::st_crs().

call

The execution environment of a currently runningfunction, e.g.call = caller_env(). The corresponding functioncall is retrieved and mentioned in error messages as the sourceof the error.

You only need to supplycall when throwing a condition from ahelper function which wouldn't be relevant to mention in themessage.

Can also beNULL or adefused function call torespectively not display any call or hard-code a code to display.

For more information about error calls, seeIncluding function calls in error messages.

Value

a list or a json string

References

API Reference

Examples

library(sf)# POINT# create sfg pointsxy<-st_sfc(st_point(c(1,2)))xyz<-st_sfc(st_point(c(1,2,3)))xym<-st_sfc(st_point(c(1,2,3), dim="XYM"))as_esri_featureset(xy)#> [1] "{\"geometryType\":\"esriGeometryPoint\",\"spatialReference\":{},\"hasZ\":false,\"hasM\":false,\"features\":[{\"geometry\":{\"x\":1.0,\"y\":2.0},\"attributes\":{}}]}"as_esri_featureset(xyz)#> [1] "{\"geometryType\":\"esriGeometryPoint\",\"spatialReference\":{},\"hasZ\":true,\"hasM\":false,\"features\":[{\"geometry\":{\"x\":1.0,\"y\":2.0,\"z\":3.0},\"attributes\":{}}]}"as_esri_featureset(xym)#> [1] "{\"geometryType\":\"esriGeometryPoint\",\"spatialReference\":{},\"hasZ\":true,\"hasM\":false,\"features\":[{\"geometry\":{\"x\":1.0,\"y\":2.0,\"m\":3.0},\"attributes\":{}}]}"# MULTIPOINT# vector to create matrix pointsset.seed(0)x<-rnorm(12)xy<-st_sfc(st_multipoint(matrix(x, ncol=2)))xyz<-st_sfc(st_multipoint(matrix(x, ncol=3)))xym<-st_sfc(st_multipoint(matrix(x, ncol=3), dim="XYM"))as_esri_featureset(xy)#> [1] "{\"geometryType\":\"esriGeometryMultiPoint\",\"spatialReference\":{},\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":false,\"points\":[[1.2629542848807933,-0.9285670347135381],[-0.3262333607056494,-0.29472044679056025],[1.3297992629225006,-0.0057671727475369534],[1.2724293214294045,2.404653388857951],[0.41464143445640833,0.7635934611404593],[-1.5399500419037095,-0.7990092489893681]]},\"attributes\":{}}]}"as_esri_featureset(xyz)#> [1] "{\"geometryType\":\"esriGeometryMultiPoint\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"points\":[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]},\"attributes\":{}}]}"as_esri_featureset(xym)#> [1] "{\"geometryType\":\"esriGeometryMultiPoint\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":true,\"points\":[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]},\"attributes\":{}}]}"# LINESTRINGxy<-st_sfc(st_linestring(matrix(x, ncol=2)))xyz<-st_sfc(st_linestring(matrix(x, ncol=3)))xym<-st_sfc(st_linestring(matrix(x, ncol=3), dim="XYM"))as_esri_featureset(xy)#> [1] "{\"geometryType\":\"esriGeometryLineString\",\"spatialReference\":{},\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":false,\"paths\":[[[1.2629542848807933,-0.9285670347135381],[-0.3262333607056494,-0.29472044679056025],[1.3297992629225006,-0.0057671727475369534],[1.2724293214294045,2.404653388857951],[0.41464143445640833,0.7635934611404593],[-1.5399500419037095,-0.7990092489893681]]]},\"attributes\":{}}]}"as_esri_featureset(xyz)#> [1] "{\"geometryType\":\"esriGeometryLineString\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"paths\":[[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]]},\"attributes\":{}}]}"as_esri_featureset(xym)#> [1] "{\"geometryType\":\"esriGeometryLineString\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":true,\"paths\":[[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]]},\"attributes\":{}}]}"# MULTILINESTRINGas_esri_featureset(st_sfc(st_multilinestring(list(xy[[1]],xy[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolyline\",\"spatialReference\":{},\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":false,\"paths\":[[[1.2629542848807933,-0.9285670347135381],[-0.3262333607056494,-0.29472044679056025],[1.3297992629225006,-0.0057671727475369534],[1.2724293214294045,2.404653388857951],[0.41464143445640833,0.7635934611404593],[-1.5399500419037095,-0.7990092489893681]],[[1.2629542848807933,-0.9285670347135381],[-0.3262333607056494,-0.29472044679056025],[1.3297992629225006,-0.0057671727475369534],[1.2724293214294045,2.404653388857951],[0.41464143445640833,0.7635934611404593],[-1.5399500419037095,-0.7990092489893681]]]},\"attributes\":{}}]}"as_esri_featureset(st_sfc(st_multilinestring(list(xyz[[1]],xyz[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolyline\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"paths\":[[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]],[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]]},\"attributes\":{}}]}"as_esri_featureset(st_sfc(st_multilinestring(list(xym[[1]],xym[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolyline\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"paths\":[[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]],[[1.2629542848807933,0.41464143445640833,-0.0057671727475369534],[-0.3262333607056494,-1.5399500419037095,2.404653388857951],[1.3297992629225006,-0.9285670347135381,0.7635934611404593],[1.2724293214294045,-0.29472044679056025,-0.7990092489893681]]]},\"attributes\":{}}]}"# POLYGONcoords<-rbind(c(0,0,0,1),c(0,1,0,1),c(1,1,1,1),c(1,0,1,1),c(0,0,0,1))xy<-st_sfc(st_polygon(list(coords[,1:2])))xyz<-st_sfc(st_polygon(list(coords[,1:3])))xym<-st_sfc(st_polygon(list(coords[,1:3]), dim="XYM"))as_esri_featureset(xy)#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":false,\"rings\":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]},\"attributes\":{}}]}"as_esri_featureset(xyz)#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"rings\":[[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]]]},\"attributes\":{}}]}"as_esri_featureset(xym)#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":true,\"rings\":[[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]]]},\"attributes\":{}}]}"# MULTIPOLYGONas_esri_featureset(st_sfc(st_multipolygon(list(xy[[1]],xy[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"features\":[{\"geometry\":{\"hasZ\":false,\"hasM\":false,\"rings\":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]],[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]},\"attributes\":{}}]}"as_esri_featureset(st_sfc(st_multipolygon(list(xyz[[1]],xyz[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"rings\":[[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]],[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]]]},\"attributes\":{}}]}"as_esri_featureset(st_sfc(st_multipolygon(list(xym[[1]],xym[[1]]))))#> [1] "{\"geometryType\":\"esriGeometryPolygon\",\"spatialReference\":{},\"hasZ\":true,\"features\":[{\"geometry\":{\"hasZ\":true,\"hasM\":false,\"rings\":[[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]],[[0.0,0.0,0.0],[0.0,1.0,0.0],[1.0,1.0,1.0],[1.0,0.0,1.0],[0.0,0.0,0.0]]]},\"attributes\":{}}]}"

Was this page helpful?

Your browser is no longer supported. Please upgrade your browser for the best experience. See ourbrowser deprecation post for more details.


[8]ページ先頭

©2009-2025 Movatter.jp