Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #175 #179

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Fix #175 #179

merged 5 commits into from
Apr 10, 2024

Conversation

elipousson
Copy link
Contributor

Also implement new rbind_results() function added w/ R-ArcGIS/arcgisutils#38

Changes

Per the discussion in draft PR: #167 this PR fixes an issue w/ returning fields not specified in fields argument and

Issues that this closes

#175

Follow up tasks

Additional changes as described in draft PR.

Also implement new rbind_results function added w/ R-ArcGIS/arcgisutils#38
Also add match_fields helper
@elipousson elipousson changed the title R arc gis main Fix #175 Apr 9, 2024
R/arc-select.R Outdated Show resolved Hide resolved
@JosiahParry
Copy link
Collaborator

This is super clear! Thank you!

We should add some tests here:

  1. what happens when we return no fields? fields = ""
  2. testing that when we have specified fields e.g fields = c("a", "b")
  3. fields with objectid specified
  4. using fields with a Table.

@elipousson if youre comfortable with me pushing to your branch I could write the tests

Co-authored-by: Josiah Parry <josiah.parry@gmail.com>
@elipousson
Copy link
Contributor Author

Please go ahead with the tests, @JosiahParry.

Empty strings, "", cause match_fields() to error. The arg_match function helpfully lists the permitted field names and will flag any suspected spelling errors.

99% sure fields works fine with tables as well as FeatureLayers (the check for a sf_column attribute just returns NULL in that case). Passing object ID values to fields also works just fine.

You can't select or drop the geometry column using fields which makes it a bit different than a SQL query when using sf::st_read().

There may be a few more changes we want to make when I pull in the renaming and alias assignment features that I set up for arc_read(). That could easily be exported as a standalone function so it could be used with layers accessed via arc_select() if you'd like.

Also expose error_arg parameter for match_fields
@elipousson
Copy link
Contributor Author

Caught one more issue - I forgot to remove the existing check for fields that was expecting a scalar input. All good now, I think.

…ers to return no fields by providing an empty character string

fields <- match_fields(
fields = fields,
values = c(x[["fields"]][["name"]], "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elipousson this is the only change I made. This will allow users to return only geometry if they so choose.

@JosiahParry JosiahParry merged commit 479507a into R-ArcGIS:main Apr 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants