3

I am trying to import data from a WFS using OGR2OGR. I am not sure of the syntax I need to pass the username and password of the WFS.

I am using D:\Astun\Tools\OGR2.1.3>ogr2ogr.exe -skipfailures -overwrite -f "ESRI ShapeFile" -a_srs "EPSG:27700" "C:\Users\callen\Desktop\test.shp" WFS:https://data.wdm.co.uk/geoserver/EssexData/ows?version=1.1.0 "User:Pwd" "EssexData:WFS_SCHEME_ANNUAL_WORKS_17_18"

I get an error message saying:

ERROR 1: HTTP error code : 401
ERROR 1: Error returned by server : HTTP error code : 401 (0)
FAILURE:
Unable to open datasource `WFS:https://data.wdm.co.uk/geoserver/EssexData/ows?ve
rsion=1.1.0' with the following drivers.
  -> JP2ECW
  -> PostgreSQL
  -> PCIDSK
  -> JP2OpenJPEG
  -> PDF
  -> DB2ODBC
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> OGR_SDTS
  -> S57
  -> DGN
  -> OGR_VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> LIBKML
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> OGR_GMT
  -> GPKG
  -> SQLite
  -> ODBC
  -> WAsP
  -> PGeo
  -> MSSQLSpatial
  -> MySQL
  -> OpenFileGDB
  -> XPlane
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDUMP
  -> OSM
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> OGR_PDS
  -> WFS
  -> HTF
  -> AeronavFAA
  -> Geomedia
  -> EDIGEO
  -> GFT
  -> SVG
  -> CouchDB
  -> Cloudant
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> ODS
  -> XLSX
  -> ElasticSearch
  -> Walk
  -> Carto
  -> SXF
  -> Selafin
  -> JML
  -> PLSCENES
  -> CSW
  -> VDV
  -> TIGER
  -> AVCBin
  -> AVCE00
  -> HTTP

What am I doing wrong?

0
3

You can try two things:

place the u/p in the URL like this:

https://user:password@data.wdm.co.uk/geoserver/EssexData/ows?version=1.1.0 

OR

instead of pointing directly to the WFS service you can point to local XML file with the following content:

<OGRWFSDataSource>
    <URL>https://data.wdm.co.uk/geoserver/EssexData/ows</URL>
    <UserPwd>User:Password</UserPwd>
    <HttpAuth>BASIC</HttpAuth>
    <Version>1.1.0</Version>
</OGRWFSDataSource>

https://gdal.org/drivers/vector/wfs.html

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.