-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend DescribeFeatureType methods to support multiple typeNames #65
Comments
I think I misread what the element vs complexType are, however I'm still wondering whether the metadata could help one see what's geographical (sf) vs not (data.frame). |
DescribeFeatureType should target 0..* cardinality for typeNames , as part of the WFS spec, so in principle we should be able to implement it. Possibly the same for GetFeatures, but i can't work on it immediatly. In general DescribeFeatureType and GetFeature are not used on more than one typeNames, although it is possible in the standard model. You can get information of feature type before doing Get Feature, you do it when finding/accessing a feature type where a DescribeFeatureType operation is done when triggering For example wfs <- WFSClient$new("https://www.fao.org/fishery/geoserver/wfs", "2.0.0", logger = "INFO")
fao_areas <- wfs$capabilities$findFeatureTypeByName("fifao:FAO_MAJOR")
fao_areas_desc <- fao_areas$getDescription(pretty = T) |
Thank you! Oh right and if none of the types is "geometry" then one can conclude it'll be a data.frame, correct? |
Yes ows4R behaves like that. You can publish (in particular in Geoserver) geometryless data through WFS protocol, ows4R will retrieve a data.frame instead of a sf object. |
You can still filter over the properties you want to be part of the output with the WFS fao_areas_data = fao_areas$getFeatures(propertyName = "F_CODE,F_LEVEL") |
Thanks! Is this "type guessing before download" something that should happen in ows4R (like |
The
|
I think by type I meant layer type actually. I.e. knowing in advance when we do |
Example: library("EMODnetWFS")
wfs <- emodnet_init_wfs_client(
service = "biology_occurrence_data"
)
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> Loading IANA mime types...
#> No encoding supplied: defaulting to UTF-8.
#> ✓ WFS client created succesfully
#> ℹ Service: 'http://geo.vliz.be/geoserver/Dataportal/wfs'
#> ℹ Version: '2.0.0'
layers <- emodnet_get_wfs_info(wfs)[["layer_name"]]
is_geom <- function(layer_name, wfs) {
layer <- wfs$capabilities$findFeatureTypeByName(sprintf("Dataportal:%s", layer_name))
geom <- any(layer$getDescription(pretty = T)$type == "geometry")
tibble::tibble(
layer = layer_name,
geom = geom
)
}
layers_info <- purrr::map_df(layers, is_geom, wfs = wfs)
knitr::kable(layers_info)
Created on 2022-03-11 by the reprex package (v2.0.1) |
sf::st_read()
(that's used in ows4R) returns a data.frame.The context is that I'm wondering how we could get more info on what we're going to get before using
getFeatures()
itself.Thanks in advance!
The text was updated successfully, but these errors were encountered: