eblondel / ows4R

R Interface for OGC Web-Services (OWS)
https://eblondel.github.io/ows4R/
Other
37 stars 8 forks source link

WFS query failing for reasons unknown #129

Open fdetsch opened 4 days ago

fdetsch commented 4 days ago

I am getting an error while querying this WFS for German ALKIS parcel data. Here's my R code and the resulting error (that I cannot quite make sense of):

wfs_r = ows4R::WFSClient$new(
  "https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis"
  , serviceVersion = "2.0.0"
)

## get feature types and print to console
(
  feature_types = wfs_r$getFeatureTypes(
    pretty = TRUE
  )
)

## get features
wfs_r$getFeatures(
  feature_types$name[1L]
  , maxfeatures = 10L # not sure if this would be considered
)

Error in startsWith(type, gml_xmlns$id) : non-character object(s)

By contrast, the code works in Python when querying the WFS through {owslib}:

from owslib.wfs import WebFeatureService
import geopandas as gpd

wfs_py = WebFeatureService(
  'https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis',
  version='2.0.0'
)

print(list(wfs_py.contents))

resp = wfs_py.getfeature(
  'cp:CadastralParcel',
  maxfeatures=10
)

result = gpd.read_file(resp)

result.shape # (10, 14)
type(result) # <class 'geopandas.geodataframe.GeoDataFrame'>

Any specific reason why the R {ows4R} based approach is failing?

eblondel commented 4 days ago

I will check ASAP and let you know

Le jeu. 28 nov. 2024, 15:29, Florian Detsch @.***> a écrit :

I am getting an error while querying this WFS https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?REQUEST=GetCapabilities&SERVICE=WFS for German ALKIS parcel data. Here's my R code and the resulting error (that I cannot quite make sense of):

wfs_r = ows4R::WFSClient$new( "https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis" , serviceVersion = "2.0.0" )

get feature types and print to console

( feature_types = wfs_r$getFeatureTypes( pretty = TRUE ) )

get featureswfs_r$getFeatures(

feature_types$name[1L] , maxfeatures = 10L # not sure if this would be considered )

Error in startsWith(type, gml_xmlns$id) : non-character object(s)

By contrast, the code works in Python when querying the WFS through {owslib}:

from owslib.wfs import WebFeatureServiceimport geopandas as gpd wfs_py = WebFeatureService( 'https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis', version='2.0.0' ) print(list(wfs_py.contents)) resp = wfs_py.getfeature( 'cp:CadastralParcel', maxfeatures=10 ) result = gpd.read_file(resp) result.shape # (10, 14)type(result) # <class 'geopandas.geodataframe.GeoDataFrame'>

Any specific reason why the R {ows4R} based approach is failing?

— Reply to this email directly, view it on GitHub https://github.com/eblondel/ows4R/issues/129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDK3EMDDW22HE6XSOGVGL2C4SGNAVCNFSM6AAAAABSVIQGSWVHI2DSMVQWIX3LMV43ASLTON2WKOZSG4YDEMZTGQ4DONI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

eblondel commented 2 days ago

just added a small patch that should make it work.

fdetsch commented 1 day ago

Confirmed, thanks!