You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Creating a simple feature object from an ArcGIS FeatureLayer
29
32
30
-
```r
33
+
34
+
```r
31
35
library(arcgis)
32
36
#> Attaching core arcgis packages:
33
-
#> → arcgisutils v0.2.0
34
-
#> → arcgislayers v0.2.0
37
+
#> → arcgisutils v0.2.0.9000
35
38
```
36
39
37
-
`arc_open()` takes a URL to create a reference to a remote ArcGIS layer,
38
-
server, or table. The function can return any of the following classes
39
-
(corresponding to different ArcGIS service types):
40
+
`arc_open()` takes a URL to create a reference to a remote ArcGIS layer, server, or table. The function can return any of the following classes (corresponding to different ArcGIS service types):
40
41
41
-
-`FeatureLayer`
42
-
-`Table`
43
-
-`FeatureServer`
44
-
-`ImageServer`
45
-
-`MapServer`
46
-
-`GroupLayer`
42
+
-`FeatureLayer`
43
+
-`Table`
44
+
-`FeatureServer`
45
+
-`ImageServer`
46
+
-`MapServer`
47
+
-`GroupLayer`
48
+
49
+
For example, you can create a `FeatureLayer` object based on a Feature Server URL:
50
+
47
51
48
-
For example, you can create a `FeatureLayer` object based on a Feature
You can then use `arc_select()` to query the feature layer object and
65
-
return an `sf` object.
65
+
You can then use `arc_select()` to query the feature layer object and return an `sf` object.
66
66
67
-
If no arguments are provided to `arc_select()` the entire feature layer
68
-
is returned in memory as an `sf` object.
67
+
If no arguments are provided to `arc_select()` the entire feature layer is returned in memory as an `sf` object.
69
68
70
-
```r
69
+
70
+
```r
71
71
arc_select(county_fl)
72
-
#> Iterating ■■■■■■■■■■■■■■■■ 50% | ETA: 1s
72
+
#> Iterating ■■■■■■■■■■■■■■■■ 50% | ETA: 2s
73
73
#> Simple feature collection with 3143 features and 12 fields
74
74
#> Geometry type: MULTIPOLYGON
75
75
#> Dimension: XY
@@ -110,46 +110,42 @@ arc_select(county_fl)
110
110
#> 9 MULTIPOLYGON (((-85.58963 3...
111
111
#> 10 MULTIPOLYGON (((-85.41657 3...
112
112
```
113
+
### Filtering using `where` or `filter_geom` arguments
113
114
114
-
### Filtering using `where`or `filter_geom` arguments
115
+
You can also use the `fields` argument to select columns or the `where` argument to subset rows.
115
116
116
-
You can also use the `fields` argument to select columns or the `where`
117
-
argument to subset rows.
117
+
For example, using a character vector of column names for `fields` and a simple SQL where clause for `where` you can select counties with population greater than 1,000,000:
118
118
119
-
For example, using a character vector of column names for `fields` and a
120
-
simple SQL where clause for `where` you can select counties with
121
-
population greater than 1,000,000:
122
119
123
-
```r
120
+
```r
124
121
arc_select(
125
122
county_fl,
126
123
fields= c("state_abbr", "population"),
127
124
where="population > 1000000"
128
125
)
129
-
#> Simple feature collection with 49 features and 3 fields
126
+
#> Simple feature collection with 49 features and 2 fields
#> 1 AZ 4420568 101 MULTIPOLYGON (((-111.0425 3...
137
-
#> 2 AZ 1043433 104 MULTIPOLYGON (((-110.4522 3...
138
-
#> 3 CA 1682353 184 MULTIPOLYGON (((-121.4721 3...
139
-
#> 4 CA 1165927 190 MULTIPOLYGON (((-122.3076 3...
140
-
#> 5 CA 1008654 193 MULTIPOLYGON (((-120.6636 3...
141
-
#> 6 CA 10014009 202 MULTIPOLYGON (((-118.1067 3...
142
-
#> 7 CA 3186989 213 MULTIPOLYGON (((-117.509 33...
143
-
#> 8 CA 2418185 216 MULTIPOLYGON (((-116.0824 3...
144
-
#> 9 CA 1585055 217 MULTIPOLYGON (((-121.6652 3...
145
-
#> 10 CA 2181654 219 MULTIPOLYGON (((-117.7832 3...
132
+
#> STATE_ABBR POPULATION geometry
133
+
#> 1 AZ 4420568 MULTIPOLYGON (((-111.0425 3...
134
+
#> 2 AZ 1043433 MULTIPOLYGON (((-110.4522 3...
135
+
#> 3 CA 1682353 MULTIPOLYGON (((-121.4721 3...
136
+
#> 4 CA 1165927 MULTIPOLYGON (((-122.3076 3...
137
+
#> 5 CA 1008654 MULTIPOLYGON (((-120.6636 3...
138
+
#> 6 CA 10014009 MULTIPOLYGON (((-118.1067 3...
139
+
#> 7 CA 3186989 MULTIPOLYGON (((-117.509 33...
140
+
#> 8 CA 2418185 MULTIPOLYGON (((-116.0824 3...
141
+
#> 9 CA 1585055 MULTIPOLYGON (((-121.6652 3...
142
+
#> 10 CA 2181654 MULTIPOLYGON (((-117.7832 3...
146
143
```
147
144
148
-
For `FeatureLayer` and `Table` objects, and sometimes `ImageServer`s,
149
-
the `list_fields()` function can be helpful to check available
150
-
attributes and build a `where` query:
145
+
For `FeatureLayer` and `Table` objects, and sometimes `ImageServer`s, the `list_fields()` function can be helpful to check available attributes and build a `where` query:
You can also provide a `bbox`, `sfc`, or `sfg` object to the
196
-
`filter_geom` argument to perform a spatial filter. If the `sfc` object
197
-
contains more than one geometry, the object is combined with
198
-
`sf::st_union()`. See documentation for more (`?arc_select`).
191
+
You can also provide a `bbox`, `sfc`, or `sfg` object to the `filter_geom` argument to perform a spatial filter. If the `sfc` object contains more than one geometry, the object is combined with `sf::st_union()`. See documentation for more (`?arc_select`).
#> Simple feature collection with 100 features and 14 fields
206
200
#> Geometry type: MULTIPOLYGON
@@ -242,14 +236,12 @@ arc_select(
242
236
243
237
### Creating a `SpatRaster` from an ArcGIS ImageServer
244
238
245
-
A `SpatRaster` object from the `{terra}` package can be extracted from
246
-
an `ImageServer` using `arc_raster()`.
239
+
A `SpatRaster` object from the `{terra}` package can be extracted from an `ImageServer` using `arc_raster()`.
247
240
248
-
`arc_raster()` will extract the area defined by `xmin`, `ymin`, `xmax`,
249
-
and `ymax`. You can optionally specify the `width` and `height` of the
250
-
resultant image. Use `format` to define what type of image is returned.
241
+
`arc_raster()` will extract the area defined by `xmin`, `ymin`, `xmax`, and `ymax`. You can optionally specify the `width` and `height` of the resultant image. Use `format` to define what type of image is returned.
- interacting with [non-public](https://doc.arcgis.com/en/arcgis-online/share-maps/share-items.htm) services,
269
+
- publishing a new service (the authorized user must also have [publishing privileges](https://doc.arcgis.com/en/arcgis-online/administer/roles.htm)), and
270
+
- modifying or deleting any existing service (the authorized user must also have [edit access](https://doc.arcgis.com/en/arcgis-online/manage-data/manage-editing-hfl.htm) to the service).
287
271
288
272
### Accessing non-public data
289
273
290
-
The same functions for reading public ArcGIS Online and Enterprise
291
-
services (such as
292
-
`arc_open()`,`arc_read()`,`arc_select()`,`arc_raster()`, etc.) can be
293
-
used to read data from non-public services by using the `token`
294
-
argument. For more information on tokens and authorization functions,
The same functions for reading public ArcGIS Online and Enterprise services (such as `arc_open()`,`arc_read()`,`arc_select()`,`arc_raster()`, etc.) can be used to read data from non-public services by using the `token` argument.
275
+
For more information on tokens and authorization functions, see the [authorization article](https://r.esri.com/r-bridge-site/location-services/connecting-to-a-portal.html).
297
276
298
277
### Publishing and modifying services from R
299
278
300
279
The package includes functions to publish data to an ArcGIS Portal:
301
280
302
-
-`add_item()`: Creates a new FeatureCollection from a `sf` or
303
-
`data.frame` object
281
+
-`add_item()`: Creates a new FeatureCollection from a `sf` or `data.frame` object
304
282
-`publish_item()`: Publishes an existing FeatureLayer
305
-
-`publish_layer()`: is a higher level wrapper around both `add_item()`
306
-
and `publish_item()`
283
+
-`publish_layer()`: is a higher level wrapper around both `add_item()` and `publish_item()`
307
284
308
-
There are also functions to add or modify data including
309
-
`add_features()`, `update_features()`, and `delete_features()`. For a
310
-
more detailed guide to adding, updating, and deleting features, view the
There are also functions to add or modify data including `add_features()`, `update_features()`, and `delete_features()`. For a more detailed guide to adding, updating, and deleting features, view the tutorial on the [R-ArcGIS Bridge website](https://r.esri.com/r-bridge-site/location-services/workflows/add-delete-update.html).
313
286
314
-
These functions all require authorization since data cannot be published
315
-
or modified anonymously in ArcGIS Online and ArcGIS Enterprise.
287
+
These functions all require authorization since data cannot be published or modified anonymously in ArcGIS Online and ArcGIS Enterprise.
0 commit comments