arcgislayers icon indicating copy to clipboard operation
arcgislayers copied to clipboard

Replace domains information

Open vidonne opened this issue 1 year ago • 5 comments

Is there a way to replace the value in a feature service with the domains values?

For example, when I run the following, I get code for the "iso3" column:

library(arcgislayers)

furl <- "https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_a_unhcr/FeatureServer/0"

pop_fl <- arc_open(furl)

arc_select(pop_fl, fields = c("iso3"), where = "iso3='SSD'")
#> Simple feature collection with 1 feature and 1 field
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 2696545 ymin: 388463.4 xmax: 4001680 ymax: 1371522
#> Projected CRS: WGS 84 / Pseudo-Mercator
#>   iso3                       geometry
#> 1  SSD MULTIPOLYGON (((3797469 106...

But it would be good to be able to get the domains values associated like you can do with {esri2sf} package, as shown below:

library(esri2sf)

furl <- "https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_a_unhcr/FeatureServer/0"

esri2sf(furl, outFields = c("iso3"), where = "iso3='SSD'", replaceDomainInfo = TRUE)
#> Layer Type: Feature Layer
#> Geometry Type: esriGeometryPolygon
#> Service Coordinate Reference System: 3857
#> Output Coordinate Reference System: 4326
#> Simple feature collection with 1 feature and 1 field
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 24.22348 ymin: 3.487471 xmax: 35.9477 ymax: 12.22673
#> Geodetic CRS:  WGS 84
#>          iso3                          geoms
#> 1 South Sudan MULTIPOLYGON (((34.11325 9....

Did I miss it somewhere in the documentation or is there an Web service related way to do so? I know that "iso3" is not the best use case for this but it's a simple example and we do have services that code some location or population type that would be good to be able to get the label and not the code out of the arcgislayer call.

Thanks for the great package and your support on this. Cedric

vidonne avatar Jan 31 '24 14:01 vidonne