EMODnet / emodnet.wfs

Access EMODnet Web Feature Service data through R
https://emodnet.github.io/emodnet.wfs/
Other
8 stars 4 forks source link

Bug with a layer of chemistry_marine_litter #165

Open maelle opened 8 months ago

maelle commented 8 months ago

The comment " Failed to parse QName 'ms:'" actually appears thousands of times.

library("EMODnetWFS")
service <- "chemistry_marine_litter"
layers_info <- emodnet_get_wfs_info(service = service)
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://www.ifremer.fr/services/wfs/emodnet_chemistry2"
#> ℹ Version: "2.0.0"
layer <- layers_info[layers_info[["format"]] == "sf",][1,][["layer_name"]]

layer
#> [1] "bl_beacheslocations_monitoring"

emodnet_get_layers(service = service, layers = layer)[[1]] |>
    sf::st_crs() |>
    print()
#> ✔ WFS client created successfully
#> ℹ Service: "https://www.ifremer.fr/services/wfs/emodnet_chemistry2"
#> ℹ Version: "2.0.0"
#> Failed to parse QName 'ms:'
#> Failed to parse QName 'ms:'
#> Coordinate Reference System:
#>   User input: WGS 84 
#>   wkt:
#> GEOGCRS["WGS 84",
#>     DATUM["World Geodetic System 1984",
#>         ELLIPSOID["WGS 84",6378137,298.257223563,
#>             LENGTHUNIT["metre",1]]],
#>     PRIMEM["Greenwich",0,
#>         ANGLEUNIT["degree",0.0174532925199433]],
#>     CS[ellipsoidal,2],
#>         AXIS["geodetic latitude (Lat)",north,
#>             ORDER[1],
#>             ANGLEUNIT["degree",0.0174532925199433]],
#>         AXIS["geodetic longitude (Lon)",east,
#>             ORDER[2],
#>             ANGLEUNIT["degree",0.0174532925199433]],
#>     USAGE[
#>         SCOPE["unknown"],
#>         AREA["World"],
#>         BBOX[-90,-180,90,180]],
#>     ID["EPSG",4326]]

Created on 2024-03-21 with reprex v2.1.0

maelle commented 8 months ago

The same code run with "suppressXMLNamespaceWarning" generates no warning. It means the "ms:" namespace isn't defined.

From the docs of the XML package,

This is used to control the situation when an XML node or attribute is created with a name space prefix that currently has no definition for that node. This is not necessarily an error but can lead to one.

library("EMODnetWFS")
service <- "chemistry_marine_litter"
layers_info <- emodnet_get_wfs_info(service = service)
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://www.ifremer.fr/services/wfs/emodnet_chemistry2"
#> ℹ Version: "2.0.0"
layer <- layers_info[layers_info[["format"]] == "sf",][2,][["layer_name"]]

layer
#> [1] "bl_temporalcoverage_numbersurveys_monitoring"

withr::local_options("suppressXMLNamespaceWarning" = TRUE)

emodnet_get_layers(service = service, layers = layer)[[1]] |>
    sf::st_crs() |>
    print()
#> ✔ WFS client created successfully
#> ℹ Service: "https://www.ifremer.fr/services/wfs/emodnet_chemistry2"
#> ℹ Version: "2.0.0"
#> Coordinate Reference System:
#>   User input: WGS 84 
#>   wkt:
#> GEOGCRS["WGS 84",
#>     DATUM["World Geodetic System 1984",
#>         ELLIPSOID["WGS 84",6378137,298.257223563,
#>             LENGTHUNIT["metre",1]]],
#>     PRIMEM["Greenwich",0,
#>         ANGLEUNIT["degree",0.0174532925199433]],
#>     CS[ellipsoidal,2],
#>         AXIS["geodetic latitude (Lat)",north,
#>             ORDER[1],
#>             ANGLEUNIT["degree",0.0174532925199433]],
#>         AXIS["geodetic longitude (Lon)",east,
#>             ORDER[2],
#>             ANGLEUNIT["degree",0.0174532925199433]],
#>     USAGE[
#>         SCOPE["unknown"],
#>         AREA["World"],
#>         BBOX[-90,-180,90,180]],
#>     ID["EPSG",4326]]

Created on 2024-03-21 with reprex v2.1.0

maelle commented 8 months ago

@salvafern have you encountered this before? Should we contact the maintainers of that service?

maelle commented 8 months ago

@salvafern friendly reminder :smile_cat: (note, I do not know who maintains the service)

maelle commented 7 months ago

maybe use the workaround in the meantime

maelle commented 7 months ago

now the workaround does not work anymore?! :sob:

maelle commented 7 months ago

it'd make more sense to ask the service maintainers.

maelle commented 7 months ago

I'll come back to this another time.

maelle commented 3 months ago

@salvafern do you think we could/should ask the service maintainers? it's weird it does not come up for other services.

maelle commented 3 months ago

even using withr::local_options("suppressXMLNamespaceWarning" = TRUE) does not suppress the warning.

salvafern commented 3 months ago

I just saw the error in the example you provided here. I will check who is the maintainer

bart-v commented 3 months ago

ms: is a standard/default prefix for MapServer https://github.com/MapServer/MapServer/issues/1461

So, the WFS validator should be able to deal with this. Just like many other libraries which took that into account years ago, already... http://lists.maptools.org/pipermail/chameleon-dev/2006-December/004690.html https://gis.stackexchange.com/questions/75756/openlayers-and-wfs-using-a-mapfile-correctly-with-featuretype-and-featurens

maelle commented 3 months ago

Ok, let's leave this aside for now. Thank you!

I'm surprised that my workaround from earlier (suppressing the warning) no longer works.