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

Unexpected errors when following "emodnet.wfs: Access EMODnet Web Feature Service data through R" script #184

Open
ndgallo opened this issue Jan 2, 2025 · 4 comments

Comments

@ndgallo
Copy link

ndgallo commented Jan 2, 2025

Hello,

I am trying to use the EMODNet WFS in R and was working through the provided script (https://github.com/EMODnet/emodnet.wfs?tab=readme-ov-file). However, I have run into two issues towards the end of the script. Everything worked correctly up until the section on extracting layers.

The first error is in the section, "Get data from a data source: get layers"
Whenever I try to extract data, I get the following url error message.

R prompt: emodnet_get_layers(wfs = wfs_bio, layers = layers)
Error message: "Warning messages:

1: Download of layer "mediseh_zostera_m_pnt" failed: Error in curl::curl_fetch_memory(url, handle = handle): URL using bad/illegal

format or missing URL: URL rejected: Malformed input to a URL function

2: Download of layer "mediseh_posidonia_nodata" failed: Error in curl::curl_fetch_memory(url, handle = handle): URL using

bad/illegal format or missing URL: URL rejected: Malformed input to a URL function"

This same error message is received when I also use the other prompt to download layers:
"emodnet_get_layers(
service = "biology",
layers = c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
)"

Additionally, I receive an error with the prompt at the end of the script:
"emodnet_get_layers(
service = "biology",
layers = c("mediseh_posidonia_nodata"),
simplify = TRUE
)"

The error message is, "WFS client created successfully
ℹ Service: "https://geo.vliz.be/geoserver/Emodnetbio/wfs"
ℹ Version: "2.0.0"
Error in emodnet_get_layers():
! Can't reduce layers when one is a data.frame
ℹ data.frame layer(s): "mediseh_posidonia_nodata"
Run rlang::last_trace() to see where the error occurred."

In the tutorial, the sf object appears to be successfully returned.

Thank you for your help in addressing these issues.

Natalya

@maelle
Copy link
Collaborator

maelle commented Jan 7, 2025

👋 @ndgallo! Thank you for your interest in the package and bug report.

Was it the code below that failed for you?

library("emodnet.wfs")
wfs_bio <- emodnet_init_wfs_client(service = "biology")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://geo.vliz.be/geoserver/Emodnetbio/wfs"
#> ℹ Version: "2.0.0"
layers <- c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
emodnet_get_layer_info(wfs = wfs_bio, layers = layers)
#> # A tibble: 2 × 9
#> # Rowwise: 
#>   data_source service_name    service_url layer_name title abstract class format
#>   <chr>       <chr>           <chr>       <chr>      <chr> <chr>    <chr> <chr> 
#> 1 emodnet_wfs https://geo.vl… biology     mediseh_p… EMOD… "Coastl… WFSF… data.…
#> 2 emodnet_wfs https://geo.vl… biology     mediseh_z… EMOD… "Zoster… WFSF… data.…
#> # ℹ 1 more variable: layer_namespace <chr>

Created on 2025-01-07 with reprex v2.1.1

Does it still fail today? I wonder whether it could have been a temporary glitch with the service. https://monitor.emodnet.eu/resources?lang=en&resource_type=WWW%3ALINK

@mariolambrette
Copy link

mariolambrette commented Jan 15, 2025

Hello, I have just started trying to use the package and I am getting the same error on that bit of code. I am on R version 4.3.1 and installed version 2.0.2.9000 of emodnet.wfs from github using pak .

library(emodnet.wfs)
wfs_bio <- emodnet_init_wfs_client(service = "biology")
layers <- c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
emodnet_get_layers(wfs = wfs_bio, layers = layers)
#> $mediseh_zostera_m_pnt
#> NULL
#> 
#> $mediseh_posidonia_nodata
#> NULL
#> 
#> Warning messages:
#> 1: Download of layer "mediseh_zostera_m_pnt" failed: Error in curl::curl_fetch_memory(url, handle = handle): URL using bad/illegal format or missing URL: URL
rejected: Malformed input to a URL function 
#> 2: Download of layer "mediseh_posidonia_nodata" failed: Error in curl::curl_fetch_memory(url, handle = handle): URL using bad/illegal format or missing URL: URL
rejected: Malformed input to a URL function 

@maelle
Copy link
Collaborator

maelle commented Jan 16, 2025

Thank you! I see I was not using the right function.

library("emodnet.wfs")
wfs_bio <- emodnet_init_wfs_client(service = "biology")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://geo.vliz.be/geoserver/Emodnetbio/wfs"
#> ℹ Version: "2.0.0"
layers <- c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
emodnet_get_layer_info(wfs = wfs_bio, layers = layers)
#> # A tibble: 2 × 9
#> # Rowwise: 
#>   data_source service_name    service_url layer_name title abstract class format
#>   <chr>       <chr>           <chr>       <chr>      <chr> <chr>    <chr> <chr> 
#> 1 emodnet_wfs https://geo.vl… biology     mediseh_p… EMOD… "Coastl… WFSF… data.…
#> 2 emodnet_wfs https://geo.vl… biology     mediseh_z… EMOD… "Zoster… WFSF… data.…
#> # ℹ 1 more variable: layer_namespace <chr>
emodnet_get_layers(wfs = wfs_bio, layers = layers)
#> StartTag: invalid element name
#> Extra content at the end of the document
#> Warning: Download of layer "mediseh_zostera_m_pnt" failed: Error: 1: StartTag: invalid
#> element name 2: Extra content at the end of the document
#> StartTag: invalid element name
#> Extra content at the end of the document
#> Warning: Download of layer "mediseh_posidonia_nodata" failed: Error: 1: StartTag:
#> invalid element name 2: Extra content at the end of the document
#> $mediseh_zostera_m_pnt
#> NULL
#> 
#> $mediseh_posidonia_nodata
#> NULL

Created on 2025-01-16 with reprex v2.1.1

@salvafern can you also reproduce? Do you have any idea what could be wrong?

@maelle
Copy link
Collaborator

maelle commented Jan 16, 2025

Another

library("emodnet.wfs")
wfs_bio <- emodnet_init_wfs_client(service = "biology")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://geo.vliz.be/geoserver/Emodnetbio/wfs"
#> ℹ Version: "2.0.0"
emodnet_get_layers(
    wfs = wfs_bio,
    layers = "mediseh_cymodocea_pnt",
    cql_filter = "country='Israele'"
)
#> StartTag: invalid element name
#> Extra content at the end of the document
#> Warning: Download of layer "mediseh_cymodocea_pnt" failed: Error: 1: StartTag: invalid
#> element name 2: Extra content at the end of the document
#> $mediseh_cymodocea_pnt
#> NULL

Created on 2025-01-16 with reprex v2.1.1

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

No branches or pull requests

3 participants