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 12 forks source link

Some records with resource format = "wms" are not the standard wms/wfs #40

Closed ateucher closed 5 years ago

ateucher commented 5 years ago
library(bcdata)
foo <- bcdc_search(res_format = "wms", n = 1000)
#> Found 653 matches. Returning the first 1000.
#> To see them all, rerun the search and set the 'n' argument to 653.
bar <- foo[!unname(sapply(foo, function(x) sum(grepl("SDO_GEOMETRY", x$details$data_type))))]
#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.

#> Warning: Unknown or uninitialised column: 'data_type'.
lapply(bar, function(x) paste0("https://catalogue.data.gov.bc.ca/dataset/", x$id))
#> $`imagery-web-map-service`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/73b2a989-df6b-4298-bd38-c60f0254a453"
#> 
#> $`imagery-spot-15m-web-map-service`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/bcad8f9e-274b-4a29-9e06-d05def3a50c2"
#> 
#> $`landsat-web-map-service`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/ac0a7aa9-f56d-45b1-bd17-8554843de6a5"
#> 
#> $`orthophoto-web-map-service`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/3fa96b60-0260-45b7-b231-3ce4610852c0"
#> 
#> $`bc-roads-map-service-web-mercator`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/0df78c0f-ce9c-4fa4-a741-ffbc8930d82f"
#> 
#> $`bc-web-map-library`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/6164a2af-d3ac-4e92-8dbe-51a93bb5e24b"
#> 
#> $`historic-city-of-vancouver-fire-insurance-map`
#> [1] "https://catalogue.data.gov.bc.ca/dataset/1dbc0b94-54c3-4d6b-a55f-340673a5056f"

Created on 2019-04-01 by the reprex package (v0.2.1)

ateucher commented 5 years ago

This means that this won't always be reliable:

https://github.com/bcgov/bcdata/blob/bc8e7b9c9ad62906d58780c5647d7441b652be57/R/bcdc-web-services.R#L55-L58

boshek commented 5 years ago

At just a cursory glance, the resource_storage_access_method might be useful to us here:

> air <- bcdc_get_record("bc-airports")
> air[["resources"]][[1]][["resource_storage_access_method"]]
[1] "Indirect Access"
> img <- bcdc_get_record("73b2a989-df6b-4298-bd38-c60f0254a453")
> img[["resources"]][[1]][["resource_storage_access_method"]]
[1] "Direct Access"
ateucher commented 5 years ago

I think even better is resource_storage_location:

> air[["resources"]][[1]][["resource_storage_location"]]
[1] "BCGW Data Store"
ateucher commented 5 years ago

@boshek did you take care of this in the print methods?

boshek commented 5 years ago

@ateucher Not yet.