bcgov / bcdata

An R package for searching & retrieving data from the B.C. Data Catalogue
https://bcgov.github.io/bcdata
Apache License 2.0
82 stars 13 forks source link

Date/POSIX objects not working as a query parameters #218

Closed boshek closed 4 years ago

boshek commented 4 years ago
library(bcdata)
#> 
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#> 
#>     filter

bcdc_query_geodata("historical-orders-and-alerts") %>%
  filter(EVENT_START_DATE < "1950-05-01")
#> Warning: It is advised to use the permanent id ('2519363e-2ae7-46f7-a2f5-f5b29a5079d9') rather than the name of the record ('historical-orders-and-alerts') to guard against future name changes.
#> Querying 'historical-orders-and-alerts' record
#> * Using collect() on this object will return 0 features and 0 fields
#> * At most six rows of the record are printed here
#> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#> Simple feature collection with 0 features and 0 fields
#> bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
#> geographic CRS: WGS 84
#> # A tibble: 0 x 1
#> # ... with 1 variable: geometry <GEOMETRY [°]>

bcdc_query_geodata("historical-orders-and-alerts") %>%
  filter(EVENT_START_DATE < as.Date("1950-05-01"))
#> Error: There was an issue sending this WFS request
#> =========================================================================================================================================================================================
#> Request:
#>   URL: https://openmaps.gov.bc.ca/geo/pub/wfs/
#>   POST fields:
#>     SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application%2Fjson&typeNames=WHSE_HUMAN_CULTURAL_ECONOMIC.EMRG_ORDER_ALERT_AREAS_HIST_SP&SRSNAME=EPSG%3A3005&CQL_FILTER=%28%22EVENT_START_DATE%22%20%3C%20CAST%28%271950-05-01%27%20AS%20DATE%29%29&count=6
#>   Content-Type: application/x-www-form-urlencoded
#>   Accept-Encoding: gzip, deflate
#>   Accept: application/json, text/xml, application/xml, */*
#>   User-Agent: https://github.com/bcgov/bcdata
#> Response:
#>   status: HTTP/1.1 400 
#>   date: Fri, 26 Jun 2020 00:07:03 GMT
#>   server: Apache
#>   x-frame-options: allow-from (null)
#>   content-type: application/xml
#>   access-control-allow-origin: (null)
#>   access-control-allow-credentials: true
#>   access-control-allow-methods: POST, GET, OPTIONS, HEAD
#>   access-control-allow-headers: X-Requested-With, Referer, Origin, Content-Type, SOAPAction, Authorization, Accept
#>   access-control-max-age: 1000
#>   connection: close
#>   transfer-encoding: chunked

bcdc_query_geodata("historical-orders-and-alerts") %>%
  filter(EVENT_START_DATE < as.POSIXct("1950-05-01"))
#> Error: There was an issue sending this WFS request
#> =========================================================================================================================================================================================
#> Request:
#>   URL: https://openmaps.gov.bc.ca/geo/pub/wfs/
#>   POST fields:
#>     SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application%2Fjson&typeNames=WHSE_HUMAN_CULTURAL_ECONOMIC.EMRG_ORDER_ALERT_AREAS_HIST_SP&SRSNAME=EPSG%3A3005&CQL_FILTER=%28%22EVENT_START_DATE%22%20%3C%20CAST%28%271950-05-01%27%20AS%20TIMESTAMP%29%29&count=6
#>   Content-Type: application/x-www-form-urlencoded
#>   Accept-Encoding: gzip, deflate
#>   Accept: application/json, text/xml, application/xml, */*
#>   User-Agent: https://github.com/bcgov/bcdata
#> Response:
#>   status: HTTP/1.1 400 
#>   date: Fri, 26 Jun 2020 00:07:05 GMT
#>   server: Apache
#>   x-frame-options: allow-from (null)
#>   content-type: application/xml
#>   access-control-allow-origin: (null)
#>   access-control-allow-credentials: true
#>   access-control-allow-methods: POST, GET, OPTIONS, HEAD
#>   access-control-allow-headers: X-Requested-With, Referer, Origin, Content-Type, SOAPAction, Authorization, Accept
#>   access-control-max-age: 1000
#>   connection: close
#>   transfer-encoding: chunked

Created on 2020-06-25 by the reprex package (v0.3.0)