Skip to contents

Check a spatial object to see if it exceeds the current set value of 'bcdata.max_geom_pred_size' option, which controls how the object is treated when used inside a spatial predicate function in filter.bcdc_promise(). If the object does exceed the size threshold a bounding box is drawn around it and all features within the box will be returned. Further options include:

  • Try adjusting the value of the 'bcdata.max_geom_pred_size' option

  • Simplify the spatial object to reduce its size

  • Further processing on the returned object

Usage

bcdc_check_geom_size(x)

Arguments

x

object of class sf, sfc or sfg

Value

invisibly return logical indicating whether the check pass. If the return value is TRUE, the object will not need a bounding box drawn. If the return value is FALSE, the check will fails and a bounding box will be drawn.

Details

See the Querying Spatial Data with bcdata for more details.

Examples

# \donttest{
try({
  airports <- bcdc_query_geodata("bc-airports") %>% collect()
  bcdc_check_geom_size(airports)
})
#> Warning: It is advised to use the permanent id ('76b1b7a3-2112-4444-857a-afccf7b20da8') rather than the name of the record ('bc-airports') to guard against future name changes.
#> Error : There was an issue sending this WFS request
#> ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
#> Request:
#>   URL: https://openmaps.gov.bc.ca/geo/pub/wfs
#>   POST fields:
#>     resultType=hits&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application%2Fjson&typeNames=WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW&SRSNAME=EPSG%3A3005
#>   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 503
#>   date: Tue, 05 Jul 2022 21:15:11 GMT
#>   server: Apache
#>   x-frame-options: allow-from (null)
#>   x-control-flow-delay-ms: 60003
#>   content-type: text/html;charset=utf-8
#>   content-language: en
#>   content-length: 1201
#>   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
#> 
# }