0

I'm using R and I want to save WFS data from different layers to disk in GeoJSON format. Unfortunately, not each one of the layers can be queried as GeoJSON directly. So how do I have to change the following code in order to query GML data and save it in GeoJSON format?

url <- parse_url("https://geodienste.hamburg.de/HH_WFS_Strassen_und_Wegenetz")
url$query <- list(service = "wfs",
  version = "2.0.0",
  request = "GetFeature",
  typename = "de.hh.up:stadtstrassen",
  srsName = "EPSG:4326",
  # change this to "application/gml+xml; version=3.2"
  outputFormat = "application/geo+json"
)

# When outputFormat is changed to "application/gml+xml; version=3.2" above:
# WHAT do I have to do here to change the result of build_url(url) to GeoJSON format?

GET(build_url(url), 
    write_disk(
      'streets.geojson',
      overwrite = TRUE
    ),
    progress()
)

Thank you!
winnewoerp

Steven
  • 1,996
  • 3
  • 22
  • 33
winnewoerp
  • 161
  • 6

0 Answers0