Skip to content
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

Layer that is a data.frame #62

Closed
maelle opened this issue Mar 2, 2022 · 16 comments · Fixed by #83
Closed

Layer that is a data.frame #62

maelle opened this issue Mar 2, 2022 · 16 comments · Fixed by #83
Assignees

Comments

@maelle
Copy link
Collaborator

maelle commented Mar 2, 2022

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'
simple_filter_sf <- emodnet_get_layers(
    wfs = wfs,
    layers = "taxa",
    cql_filter = "scientificname='Abra'",
    reduce_layers = TRUE
)
#> Warning: Download of layer 'taxa' failed: Error in UseMethod("st_crs<-"): pas de méthode pour 'st_crs<-' applicable pour un objet de classe "data.frame"

Created on 2022-03-02 by the reprex package (v2.0.1)

@maelle
Copy link
Collaborator Author

maelle commented Mar 3, 2022

@annakrystalli for a change would you like to try running this one? 😅

@maelle maelle self-assigned this Mar 3, 2022
@annakrystalli
Copy link
Collaborator

Same error for me in http-tests branch.

I think it's because the package does some post processing to the crs that fails if the response is not an sf

@maelle
Copy link
Collaborator Author

maelle commented Mar 3, 2022

the layer type in the layer medata from wfs info was sf, should it indicate something else?

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

I see "sf" is hard-coded, maybe I can get it from the web service 👀

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

I modified ows4R code

https://github.com/eblondel/ows4R/blob/8068e7284e3c0c99f54457579602bc33174f134d/R/WFSFeatureType.R#L328

to quiet = FALSE

I get

no simple feature geometries present: returning a data.frame or tbl_df

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

I wonder whether we should expect more metadata before the download.

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

And when we do get a data.frame, the layers can obviously NOT be reduced.

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

So, TODOS

  • Find more info on data.frame layers in WFS in general.
  • Tweak the code so that we simply return the data.frame when that's what was returned by the web service.

@annakrystalli
Copy link
Collaborator

And when we do get a data.frame, the layers can obviously NOT be reduced.

That's ok because the function only tries to reduce and if it can't it returns a list

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

Related eblondel/ows4R#65

@maelle
Copy link
Collaborator Author

maelle commented Mar 11, 2022

For any layer if we get its description and see no element is a geometry, we can know it will be a data.frame rather than an sf object.

@salvafern
Copy link
Collaborator

I think @maelle 's approach in eblondel/ows4R#65 (comment) would be great. There are layers in there with no geometry as they are required or used in the infrastructure of EMODnet-Biology, so we cannot really get rid of them.

In any case I will check why some layers don't have a geometry. For instance Dataportal:eurobis-obisenv_basic. Probably someone just forgot as the important fields when exporting to csv are decimalLongitude and decimalLatitude.

@maelle
Copy link
Collaborator Author

maelle commented Apr 5, 2022

@salvafern #83 is meant to tackle this.

@salvafern
Copy link
Collaborator

Update: we should not change Dataportal:eurobis-obisenv_basic in geoserver as many other system are relying on this layer. We should go forward with #83 . @maelle are you following this up or shall I have a look?

@maelle
Copy link
Collaborator Author

maelle commented Apr 7, 2022

@salvafern My main problem in #83 is the size of fixtures. So if you can have a look at the functionality, that'd be great, I can keep thinking about the testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants