Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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 geometryType for a feature with geometry #138

Closed
maelle opened this issue Jan 24, 2025 · 1 comment
Closed

Unexpected geometryType for a feature with geometry #138

maelle opened this issue Jan 24, 2025 · 1 comment

Comments

@maelle
Copy link

maelle commented Jan 24, 2025

👋 @eblondel we're also getting new failures in tests that are related to $getGeometryType() now returning NULL for a feature that has a geometry. We use $getGeometryType() to guess whether a feature will be sf.

Is this a bug or new expected behavior? In the latter case, what would you recommend we use instead?

wfs <- suppressWarnings(
    ows4R::WFSClient$new(
        "https://ows.emodnet-seabedhabitats.eu/geoserver/emodnet_open_maplibrary/wfs",
        serviceVersion = "2.0.0",
        headers = c("User-Agent" = "emodnet.wfs"),
        logger = NULL
    )
)
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
capabilities <- wfs$getCapabilities()
layer_names <- purrr::map_chr(capabilities$getFeatureTypes(), ~ .x$getName())
types <- capabilities$getFeatureTypes()
type <- types[layer_names == "emodnet_open_maplibrary:dk003069"] |> unlist()
type[[1]]$getGeometryType()
#> NULL
type[[1]]$getBoundingBox()
#>         min      max
#> x  9.575308 10.24418
#> y 54.773777 55.12132
type[[1]]$hasGeometry()
#> [1] FALSE
layer <- wfs$getFeatures("emodnet_open_maplibrary:dk003069")
layer
#> Simple feature collection with 82 features and 8 fields
#> Geometry type: MULTISURFACE
#> Dimension:     XY
#> Bounding box:  xmin: 1065918 ymin: 7318084 xmax: 1140377 ymax: 7385447
#> Projected CRS: WGS 84 / Pseudo-Mercator
#> First 10 features:
#>            gml_id   gid      gui polygon annexi         subtype confidence
#> 1  dk003069.39844 39844 DK003069      61   1170 Geogenic origin       High
#> 2  dk003069.39855 39855 DK003069      72   1110            <NA>       High
#> 3  dk003069.39860 39860 DK003069      77   1110            <NA>       High
#> 4  dk003069.39861 39861 DK003069      78   1110            <NA>       High
#> 5  dk003069.39785 39785 DK003069       2   1170 Geogenic origin       High
#> 6  dk003069.39814 39814 DK003069      31   1170 Geogenic origin       High
#> 7  dk003069.39791 39791 DK003069       8   1170 Geogenic origin       High
#> 8  dk003069.39836 39836 DK003069      53   1170 Geogenic origin       High
#> 9  dk003069.39829 39829 DK003069      46   1170 Geogenic origin       High
#> 10 dk003069.39850 39850 DK003069      67   1110            <NA>       High
#>    val_comm                           geom
#> 1      <NA> MULTISURFACE (POLYGON ((111...
#> 2      <NA> MULTISURFACE (POLYGON ((108...
#> 3      <NA> MULTISURFACE (POLYGON ((111...
#> 4      <NA> MULTISURFACE (POLYGON ((108...
#> 5      <NA> MULTISURFACE (POLYGON ((111...
#> 6      <NA> MULTISURFACE (POLYGON ((111...
#> 7      <NA> MULTISURFACE (POLYGON ((109...
#> 8      <NA> MULTISURFACE (POLYGON ((108...
#> 9      <NA> MULTISURFACE (POLYGON ((108...
#> 10     <NA> MULTISURFACE (POLYGON ((111...

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

@salvafern

@eblondel
Copy link
Owner

@maelle You are interrogating the capabilities fo the WFS and list the feature types (modeled ad WFSFeatureType), but when you list them from the capabilities, you didn't get their full description so for a given feature type, you first need to fetch its description (performing a DescribeFeatureType request behind) with type[[1]]$getDescription(). After what you will see type[[1]]$getGeometryType() returns a geometry type.

For bounding box you get something, because that's a property of the featureType that is available through WFS capabilities document. It's not the case of the full list of feature type elements (~ column definitions).

Repository owner locked and limited conversation to collaborators Jan 24, 2025
@eblondel eblondel converted this issue into discussion #139 Jan 24, 2025
@eblondel eblondel added this to the 0.5 milestone Jan 31, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants