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

Filtering records #303

Closed
hgriesbauer opened this issue Jul 29, 2022 · 2 comments
Closed

Filtering records #303

hgriesbauer opened this issue Jul 29, 2022 · 2 comments

Comments

@hgriesbauer
Copy link
Contributor

Hi there, wondering if you could please help with an issue filtering records. I'm trying to filter VRI polygons that contain a specific tree species. The tree species is ponderosa pine, with a species code of "Py". I want to collect all VRI polygons where the 'LINE_3_TREE_SPECIES' column contains the substring "Py".

This fails:
bcdc_query_geodata("2ebb35d8-c82f-4a17-9c96-612ac3532d55") %>%
filter(grepl("Py",LINE_3_TREE_SPECIES,fixed=T))

As does this:
bcdc_query_geodata("2ebb35d8-c82f-4a17-9c96-612ac3532d55") %>%
filter(str_detect(LINE_3_TREE_SPECIES,"Py"))

I get the following error message: "There was an issue sending this WFS request", and a warning message "Named arguments ignored for SQL grepl".

How should I be coding this? Thanks!

@boshek
Copy link
Collaborator

boshek commented Jul 30, 2022

@hgriesbauer it's not currently possible with bcdata mostly because it hasn't been implemented yet. You can see an open issue here: #227

@boshek boshek closed this as completed Jul 30, 2022
@ateucher
Copy link
Collaborator

@hgriesbauer it's not implemented directly, but you can supply raw CQL and use the like keyword:

qry <- bcdc_query_geodata("2ebb35d8-c82f-4a17-9c96-612ac3532d55") %>%
  filter(CQL("LINE_3_TREE_SPECIES like '%Py%'"))

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

No branches or pull requests

3 participants