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

Support use of field alias values as column names or label attributes by arc_read() #169

Closed
elipousson opened this issue Mar 14, 2024 · 0 comments · Fixed by #180
Closed
Labels
enhancement New feature or request

Comments

@elipousson
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When used by the creator of a FeatureLayer, field aliases often provide key information about meaning of otherwise confusing field names. These aliases could be used as names for the resulting sf object or as field labels (using the same attribute used by the {labelled} package). arc_read() already has partial support for this when col_names = "alias" but this inadvertently created a bug where you can never rename an attribute to "alias" if it is a single column data frame.

Describe the solution you'd like

I'm adding the proposed solution to the open PR: #167 since it also includes fixes to other aspects of arc_read(). In the PR, the internal set_layer_names function has been renamed set_layer_col_names() and exposes a new "alias" parameter that enables users to drop, replace, or label existing column names using the alias values. Note, there is never an alias for the geometry column (as far as I can tell) so there is never a labelled assigned to geometry.

Describe alternatives you've considered

This could be done using the {labelled} package but keeping the function internal allows for a much more minimal implementation. It could potentially benefit from an alert when column names and alias values are identical but this is very very common so may not be worth it.

You could also allow users to pass labels through a separate argument and get field labels but optionally replace all or some of the the alias values. This may be better handled as a separate option if the function is exported and available for users outside of arc_read() alone.

Additional context

Handling alias values has some similarities to the interest in improving the handling of domain values #134

It is also possible this should be included in arcgisutils package instead as a helper function related to parse_esri_json() or fetch_layer_metadata() or the proposed arc_meta() function #163

@elipousson elipousson added the enhancement New feature or request label Mar 14, 2024
elipousson added a commit to elipousson/arcgislayers that referenced this issue Mar 14, 2024
elipousson added a commit to elipousson/arcgislayers that referenced this issue Apr 10, 2024
Also adds pull_field_aliases helper function
JosiahParry added a commit that referenced this issue Apr 12, 2024
Add support for alias parameter per #169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant