R-ArcGIS / arcgislayers

ArcGIS Location Services
http://r.esri.com/arcgislayers/
Apache License 2.0
37 stars 8 forks source link

FeatureLayer's return fields when none provided #175

Closed JosiahParry closed 2 months ago

JosiahParry commented 3 months ago

Describe the bug FeatureLayers will return additional fields when none are specified. This is not a bug necessarily, as this is how feature services work.

For example this query returns the NAME field even though no fields were specified https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Major_Cities_/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&relationParam=&returnGeodetic=false&outFields=&returnGeometry=true&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&defaultSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=pjson&token=

To Reproduce

library(arcgis)
#> Attaching core arcgis packages:
#> → arcgisutils v0.2.0.9000
#> → arcgislayers v0.2.0

flayer <- arc_open("https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Counties_Generalized_Boundaries/FeatureServer/0")

arc_select(flayer, fields = "")
#> Simple feature collection with 3143 features and 2 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -178.2176 ymin: 18.92179 xmax: -66.96927 ymax: 71.40624
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>               NAME OBJECTID                       geometry
#> 1   Autauga County        1 MULTIPOLYGON (((-86.82067 3...
#> 2   Baldwin County        2 MULTIPOLYGON (((-87.97309 3...
#> 3   Barbour County        3 MULTIPOLYGON (((-85.74337 3...
#> 4      Bibb County        4 MULTIPOLYGON (((-87.41986 3...
#> 5    Blount County        5 MULTIPOLYGON (((-86.96799 3...
#> 6   Bullock County        6 MULTIPOLYGON (((-85.4114 32...
#> 7    Butler County        7 MULTIPOLYGON (((-86.44912 3...
#> 8   Calhoun County        8 MULTIPOLYGON (((-85.79353 3...
#> 9  Chambers County        9 MULTIPOLYGON (((-85.58963 3...
#> 10 Cherokee County       10 MULTIPOLYGON (((-85.41657 3...

Created on 2024-03-21 with reprex v2.0.2

Expected behavior

When no fields are specified, only geometry should be returned.

Additional context

Addressed in https://github.com/R-ArcGIS/arcgislayers/pull/167