Repository navigation
Filter using string partial matching #227
Description
Activity
@webgismd do you know if the WFS can return only the attributes and leave the geometry behind?
I also wonder if you can partially match a string CQL?
I also wonder if you can partially match a string CQL?
@ateucher like this?
solr_query=title: sugar
but no idean about how to integrate this :)
https://docs.datastax.com/en/dse/6.0/cql/cql/cql_using/search_index/queryTerms.htmlSo this works:
https://openmaps.gov.bc.ca/geo/pub/wfs/?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application%2Fjson&typeNames=WHSE_TANTALIS.TA_PARK_ECORES_PA_SVW&SRSNAME=EPSG%3A3005&CQL_FILTER=PROTECTED_LANDS_NAME%20like%20%27%25BEAUMONT%25%27and dbplyr can translate
%like%:dbplyr::translate_sql(PROTECTED_LANDS_NAME %like% "%BEAUMONT%") #> <SQL> `PROTECTED_LANDS_NAME` like '%BEAUMONT%'
I think there is a path here.
Reacted by Alexandre BevingtonThis also works:
https://openmaps.gov.bc.ca/geo/pub/wfs/?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application/json&typeNames=WHSE_TANTALIS.TA_PARK_ECORES_PA_SVW&SRSNAME=EPSG:3005&CQL_FILTER=(strMatches(PROTECTED_LANDS_NAME, 'SUGARBOWL.*') = true)Using
strMatchesfrom here: https://docs.geoserver.org/stable/en/user/filter/function_reference.html#string-functions.But this doesn't work:
bcdata::bcdc_query_geodata("bc-parks-ecological-reserves-and-protected-areas") %>% filter(CQL("strMatches(PROTECTED_LANDS_NAME, 'SUGARBOWL.*') = 'true'"))
I think there's an issue sending as a POST vs GET request...
Reacted by Alexandre BevingtonUsing
strMatcheswe could make agreplshim if we can figure out how to issue the query viaPOST. It might need to be added to the url rather than as a query parameter- changed the title
[-]Collect() without geometry (workarround for filter by string)[/-][+]Filter using string partial matching[/+]on Apr 21, 2021 I changed the title of this issue since it's not actually possible to get just the attributes of a wfs layer...
Problem: I'd like to filter a query but I only know part of the string I am looking for...
Potential solution:
I could download/collect only the column that I want to filter by, detect the sting that I am looking for and then use that string to filter my query.
Problem with this solution: I need to download the geometries of the data set to get the column that I am interested in, which is essentially just downloading the entire dataset, so there is no processing speed advantage.
My question:
Is there a way to drop the geometry before collecting the data? I suspect that this would be very fast and efficient for filtering large datasets using string detection.