Skip to content

Commit

Permalink
Merge pull request #139 from bcgov/fix-layer-name-selection
Browse files Browse the repository at this point in the history
Get typeName for wfs from resource url
  • Loading branch information
ateucher authored Nov 15, 2019
2 parents d3af43b + d642cf2 commit 5ff51ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# bcdata (development version)

# bcdata 0.1.1.9999

* More reliable detection of layer name for a wfs call in `bcdc_query_geodata()` (#129, #138, #139)
* Fixed a bug where `BBOX()` used in a `filter()` statement combined with `bcdc_query_geodata()` did not work (#135, #137)
* Add `mutate` method for bcdc_promise that only fails and suggest an alternative approach. (PR#134)
* Fixed a bug where layer names with a number in them would not work in `bcdc_query_geodata()` (#126, #127)
* Add back in querying vignette

# bcdata 0.1.1
Expand Down
6 changes: 5 additions & 1 deletion R/bcdc-web-services.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ bcdc_query_geodata.bcdc_record <- function(record, crs = 3005) {
)
}

layer_name <- basename(dirname(
record$resource_df$url[record$resource_df$format == "wms"]
))

## Parameters for the API call
query_list <- make_query_list(layer_name = record$layer_name, crs = crs)
query_list <- make_query_list(layer_name = layer_name, crs = crs)

## Drop any NULLS from the list
query_list <- compact(query_list)
Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-edge-cases.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
context("Edge cases and catalogue peculiarities")

test_that("recods with wms but inconsistent layer_name, object_name fieldds work", {
# https://github.com/bcgov/bcdata/issues/138
# layer_name = RSLT_PLANTING_ALL_RSLT_CF
# object_name = WHSE_FOREST_VEGETATION.RSLT_PLANTING_SVW
# wms uses object_name
expect_is(bcdc_query_geodata("results-planting"), "bcdc_promise")

# https://github.com/bcgov/bcdata/issues/129
# layer_name = WHSE_ADMIN_BOUNDARIES.ADM_NR_DISTRICTS_SPG
# object_name = WHSE_ADMIN_BOUNDARIES.ADM_NR_DISTRICTS_SP
# wms uses layer_name (generalized)
expect_is(bcdc_query_geodata("natural-resource-nr-district"), "bcdc_promise")
})

0 comments on commit 5ff51ed

Please sign in to comment.