{"action":"created","issue":{"url":"https://api.github.com/repos/eblondel/ows4R/issues/17","repository_url":"https://api.github.com/repos/eblondel/ows4R","labels_url":"https://api.github.com/repos/eblondel/ows4R/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/eblondel/ows4R/issues/17/comments","events_url":"https://api.github.com/repos/eblondel/ows4R/issues/17/events","html_url":"https://github.com/eblondel/ows4R/issues/17","id":371822583,"node_id":"MDU6SXNzdWUzNzE4MjI1ODM=","number":17,"title":"WFS problems with geometry column and text conversion","user":{"login":"jannes-m","id":9986952,"node_id":"MDQ6VXNlcjk5ODY5NTI=","avatar_url":"https://avatars3.githubusercontent.com/u/9986952?v=4","gravatar_id":"","url":"https://api.github.com/users/jannes-m","html_url":"https://github.com/jannes-m","followers_url":"https://api.github.com/users/jannes-m/followers","following_url":"https://api.github.com/users/jannes-m/following{/other_user}","gists_url":"https://api.github.com/users/jannes-m/gists{/gist_id}","starred_url":"https://api.github.com/users/jannes-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jannes-m/subscriptions","organizations_url":"https://api.github.com/users/jannes-m/orgs","repos_url":"https://api.github.com/users/jannes-m/repos","events_url":"https://api.github.com/users/jannes-m/events{/privacy}","received_events_url":"https://api.github.com/users/jannes-m/received_events","type":"User","site_admin":false},"labels":[{"id":1096915380,"node_id":"MDU6TGFiZWwxMDk2OTE1Mzgw","url":"https://api.github.com/repos/eblondel/ows4R/labels/user%20support","name":"user support","color":"7be5d3","default":false}],"state":"open","locked":false,"assignee":{"login":"eblondel","id":1324396,"node_id":"MDQ6VXNlcjEzMjQzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1324396?v=4","gravatar_id":"","url":"https://api.github.com/users/eblondel","html_url":"https://github.com/eblondel","followers_url":"https://api.github.com/users/eblondel/followers","following_url":"https://api.github.com/users/eblondel/following{/other_user}","gists_url":"https://api.github.com/users/eblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/eblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eblondel/subscriptions","organizations_url":"https://api.github.com/users/eblondel/orgs","repos_url":"https://api.github.com/users/eblondel/repos","events_url":"https://api.github.com/users/eblondel/events{/privacy}","received_events_url":"https://api.github.com/users/eblondel/received_events","type":"User","site_admin":false},"assignees":[{"login":"eblondel","id":1324396,"node_id":"MDQ6VXNlcjEzMjQzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1324396?v=4","gravatar_id":"","url":"https://api.github.com/users/eblondel","html_url":"https://github.com/eblondel","followers_url":"https://api.github.com/users/eblondel/followers","following_url":"https://api.github.com/users/eblondel/following{/other_user}","gists_url":"https://api.github.com/users/eblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/eblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eblondel/subscriptions","organizations_url":"https://api.github.com/users/eblondel/orgs","repos_url":"https://api.github.com/users/eblondel/repos","events_url":"https://api.github.com/users/eblondel/events{/privacy}","received_events_url":"https://api.github.com/users/eblondel/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/eblondel/ows4R/milestones/1","html_url":"https://github.com/eblondel/ows4R/milestone/1","labels_url":"https://api.github.com/repos/eblondel/ows4R/milestones/1/labels","id":3117648,"node_id":"MDk6TWlsZXN0b25lMzExNzY0OA==","number":1,"title":"0.1","description":"","creator":{"login":"eblondel","id":1324396,"node_id":"MDQ6VXNlcjEzMjQzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1324396?v=4","gravatar_id":"","url":"https://api.github.com/users/eblondel","html_url":"https://github.com/eblondel","followers_url":"https://api.github.com/users/eblondel/followers","following_url":"https://api.github.com/users/eblondel/following{/other_user}","gists_url":"https://api.github.com/users/eblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/eblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eblondel/subscriptions","organizations_url":"https://api.github.com/users/eblondel/orgs","repos_url":"https://api.github.com/users/eblondel/repos","events_url":"https://api.github.com/users/eblondel/events{/privacy}","received_events_url":"https://api.github.com/users/eblondel/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":10,"state":"open","created_at":"2018-02-14T21:19:50Z","updated_at":"2018-10-19T09:58:51Z","due_on":"2018-09-01T07:00:00Z","closed_at":null},"comments":3,"created_at":"2018-10-19T06:25:49Z","updated_at":"2018-10-19T10:04:40Z","closed_at":null,"author_association":"NONE","body":"Hi Emmanuel,\r\nfirst, thank you again for developing OGC web services for R! I have played around a bit with your package, and stumbled across two potential bugs.\r\n1. When loading data into R, you seem to look for a `geometry` column (or tag), however, sometimes the column (tag) containing the geometry is unfortunately not named geometry, as is the case with this Dutch example where it is called \"geometrie\". The solution might be to use **sf** to read the downloaded GML file into R (see below, and FYI @Robinlovelace and @Nowosad):\r\n``` r\r\nlibrary(ows4R)\r\n#> Loading required package: geometa\r\n#> Loading ISO 19139 XML schemas...\r\n#> Loading ISO 19115 codelists...\r\nlibrary(sf)\r\n#> Linking to GEOS 3.6.2, GDAL 2.3.2, proj.4 5.1.0\r\nbase_url = \"http://geodata.nationaalgeoregister.nl/bag/wfs\"\r\nwfs = WFSClient$new(base_url, \"1.0.0\", logger = \"INFO\")\r\n#> [ows4R][INFO] OWSGetCapabilities - Fetching http://geodata.nationaalgeoregister.nl/bag/wfs?service=WFS&version=1.0.0&request=GetCapabilities\r\ncaps = wfs$getCapabilities()\r\ntmp = caps$findFeatureTypeByName(\"\")\r\n# find out about the available feature types\r\nsapply(tmp, function(x) x$getName())\r\n#> [1] \"bag:ligplaats\"       \"bag:pand\"            \"bag:standplaats\"    \r\n#> [4] \"bag:verblijfsobject\" \"bag:woonplaats\"\r\n# ok, let's download the national parcs of Bavaria\r\n# ft = caps$findFeatureTypeByName(\"lfu:nationalpark\")\r\nft = caps$findFeatureTypeByName(\"bag:ligplaats\")\r\n# download features\r\nfeats = ft$getFeatures()  \r\n#> [ows4R][INFO] WFSGetFeature - Fetching http://geodata.nationaalgeoregister.nl/bag/wfs?service=WFS&version=1.0.0&typeName=bag:ligplaats&logger=INFO&request=GetFeature \r\n#> [ows4R][INFO] WFSDescribeFeatureType - Fetching http://geodata.nationaalgeoregister.nl/bag/wfs?service=WFS&version=1.0.0&typeName=bag:ligplaats&request=DescribeFeatureType\r\n#> Error in if (element$getType() == \"geometry\") {: argument is of length zero\r\n# obviously getFeatures() is looking for a geometry column, however, here it\r\n# is named \"geometrie\", that's why it doesn't work this does not work\r\n# However, it downloads the gml file to the temporary directory, hence,\r\n# we can load the data into R ourselves\r\nfile = grep(\"gml\", dir(tempdir()), value = TRUE)\r\nfile = file.path(tempdir(), file)\r\n# assuming there is only one file\r\nlayer = read_sf(file)\r\nplot(layer$geometrie)\r\n```\r\n\r\n![](https://i.imgur.com/3nExgTi.png)\r\n\r\n<sup>Created on 2018-10-19 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>\r\n\r\n2. I also tried a German WFS. Here, it seems, there is some problem when using `switch()`:\r\n``` r\r\nlibrary(ows4R)\r\n#> Loading required package: geometa\r\n#> Loading ISO 19139 XML schemas...\r\n#> Loading ISO 19115 codelists...\r\nlibrary(sf)\r\n#> Linking to GEOS 3.6.2, GDAL 2.3.2, proj.4 5.1.0\r\nbase_url = \"http://www.lfu.bayern.de/gdi/wfs/naturschutz/schutzgebiete?\"\r\nwfs = WFSClient$new(base_url, \"1.0.0\", logger = \"INFO\")\r\n#> [ows4R][INFO] OWSGetCapabilities - Fetching http://www.lfu.bayern.de/gdi/wfs/naturschutz/schutzgebiete?service=WFS&version=1.0.0&request=GetCapabilities\r\ncaps = wfs$getCapabilities()\r\ntmp = caps$findFeatureTypeByName(\"\")\r\n# find out about the available feature types\r\nsapply(tmp, function(x) x$getName())\r\n#> [1] \"lfu:vogelschutzgebiet\"          \"lfu:naturpark\"                 \r\n#> [3] \"lfu:naturschutzgebiet\"          \"lfu:landschaftsschutzgebiet\"   \r\n#> [5] \"lfu:fauna_flora_habitat_gebiet\" \"lfu:biosphaerenreservat\"       \r\n#> [7] \"lfu:nationalpark\"\r\nft = caps$findFeatureTypeByName(\"lfu:nationalpark\")\r\nfeats = ft$getFeatures()  \r\n#> [ows4R][INFO] WFSGetFeature - Fetching http://www.lfu.bayern.de/gdi/wfs/naturschutz/schutzgebiete?service=WFS&version=1.0.0&typeName=lfu:nationalpark&logger=INFO&request=GetFeature \r\n#> [ows4R][INFO] WFSDescribeFeatureType - Fetching http://www.lfu.bayern.de/gdi/wfs/naturschutz/schutzgebiete?service=WFS&version=1.0.0&typeName=lfu:nationalpark&request=DescribeFeatureType\r\n#> Error in switch(type, `xsd:string` = \"character\", `xsd:long` = \"numeric\", : EXPR must be a length 1 vector\r\n# here, there seems to be a conversion error...\r\n# still, we can load the data into R ourselves\r\nfile = grep(\"gml\", dir(tempdir()), value = TRUE)\r\nfile = file.path(tempdir(), file)\r\nlayer = read_sf(file)\r\n#> Warning in CPL_read_ogr(dsn, layer, as.character(options), quiet, type, :\r\n#> GDAL Error 1: HTTP error code : 404\r\nplot(layer$geometry)\r\n```\r\n\r\n![](https://i.imgur.com/IH9qAlw.png)\r\n\r\n<sup>Created on 2018-10-19 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>\r\n \r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/64963092-wfs-problems-with-geometry-column-and-text-conversion?utm_campaign=plugin&utm_content=tracker%2F18146274&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F18146274&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/eblondel/ows4R/issues/comments/431313237","html_url":"https://github.com/eblondel/ows4R/issues/17#issuecomment-431313237","issue_url":"https://api.github.com/repos/eblondel/ows4R/issues/17","id":431313237,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTMxMzIzNw==","user":{"login":"eblondel","id":1324396,"node_id":"MDQ6VXNlcjEzMjQzOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1324396?v=4","gravatar_id":"","url":"https://api.github.com/users/eblondel","html_url":"https://github.com/eblondel","followers_url":"https://api.github.com/users/eblondel/followers","following_url":"https://api.github.com/users/eblondel/following{/other_user}","gists_url":"https://api.github.com/users/eblondel/gists{/gist_id}","starred_url":"https://api.github.com/users/eblondel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eblondel/subscriptions","organizations_url":"https://api.github.com/users/eblondel/orgs","repos_url":"https://api.github.com/users/eblondel/repos","events_url":"https://api.github.com/users/eblondel/events{/privacy}","received_events_url":"https://api.github.com/users/eblondel/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T10:04:40Z","updated_at":"2018-10-19T10:04:40Z","author_association":"OWNER","body":"@jannes-m your point 1 above is solved with #19 . For the 2d one, this requires an enhancement as it deals with feature type with type elements restrictions that i never had to deal with in WFS. I will look at time once i have free time."}}
{"actor":{"display_login":"eblondel"}}