[gdal-dev] Fwd: ogr2ogr

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu May 2 06:57:45 PDT 2019


Hi Mncedi,

Welcome to GDAL !

Here is how I recommend working through that (using a working example) :

Step 1:  ogrinfo
----------------

Always always start with an ogrinfo command, to see the available layer 
names:

	ogrinfo WFS:https://demo.gatewaygeomatics.com/cgi-bin/wfs_gateway


	returns:

		using driver `WFS' successful.
		1: ms:park

Great! We now know the layer name is called "ms:park"

Step 2: ogrinfo + layername
---------------------------

Next, see if ogrinfo can return info about that ms:park layer:

	ogrinfo WFS:https://demo.gatewaygeomatics.com/cgi-bin/wfs_gateway 
ms:park -summary

	returns:

		using driver `WFS' successful.
		Layer name: ms:park
			Metadata:
   				TITLE=Parks
				Geometry: Unknown (any)
				Feature Count: 46
				Extent: (-2346804.000000, -67422.421875) - (2840366.000000, 
3830124.250000)
				Layer SRS WKT:
				PROJCS["NAD83 / Canada Atlas Lambert"

Great! ogrinfo gave us info about our layer

Step 3: ogr2ogr + layername
---------------------------

Notice that the syntax is something like:  ogr2ogr output input layername :

	ogr2ogr -f "ESRI Shapefile" parks.shp 
WFS:https://demo.gatewaygeomatics.com/cgi-bin/wfs_gateway ms:park



Tested using MS4W 4.0 https://ms4w.com

-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/

On 2019-05-02 10:11 AM, Mncedi Dlayiya wrote:
> Hello everyone,
> 
> I am new in GDAL so I'm struggling to convert a wfs to shapefile using 
> ogr2ogr.
> 
> my command is as follows:
> 
> C:\>ogr2ogr -f "ESRI SHAPEFILE" ec_pensioners WFS:" 
> http://localhost:8080/geoserver/osw?" pensioners
> 
>   * ec_pensioners is the name of the wfs layer
>   * pensioners is the output layer
>   * " http://localhost:8080/geoserver/osw?" is where the layer is hosted 
> 
> 
> The error message I get:
> 
> FAILURE:
> Unable to open datasource `WFS: http://localhost:8080/geoserver/osw?' 
> with the following drivers.
>    -> `JP2ECW'
>    -> `OCI'
>    -> `SOSI'
>    -> `PCIDSK'
>    -> `netCDF'
>    -> `JP2OpenJPEG'
>    -> `PDF'
>    -> `MBTiles'
>    -> `EEDA'
>    -> `DB2ODBC'
>    -> `ESRI Shapefile'
>    -> `MapInfo File'
>    -> `UK .NTF'
>    -> `OGR_SDTS'
>    -> `S57'
>    -> `DGN'
>    -> `OGR_VRT'
>    -> `REC'
>    -> `Memory'
>    -> `BNA'
>    -> `CSV'
>    -> `NAS'
>    -> `GML'
>    -> `GPX'
>    -> `LIBKML'
>    -> `KML'
>    -> `GeoJSON'
>    -> `GeoJSONSeq'
>    -> `ESRIJSON'
>    -> `TopoJSON'
>    -> `Interlis 1'
>    -> `Interlis 2'
>    -> `OGR_GMT'
>    -> `GPKG'
>    -> `SQLite'
>    -> `ODBC'
>    -> `WAsP'
>    -> `PGeo'
>    -> `MSSQLSpatial'
>    -> `OGR_OGDI'
>    -> `PostgreSQL'
>    -> `MySQL'
>    -> `OpenFileGDB'
>    -> `XPlane'
>    -> `DXF'
>    -> `CAD'
>    -> `Geoconcept'
>    -> `GeoRSS'
>    -> `GPSTrackMaker'
>    -> `VFK'
>    -> `PGDUMP'
>    -> `OSM'
>    -> `GPSBabel'
>    -> `SUA'
>    -> `OpenAir'
>    -> `OGR_PDS'
>    -> `WFS'
>    -> `WFS3'
>    -> `HTF'
>    -> `AeronavFAA'
>    -> `Geomedia'
>    -> `EDIGEO'
>    -> `GFT'
>    -> `SVG'
>    -> `CouchDB'
>    -> `Cloudant'
>    -> `Idrisi'
>    -> `ARCGEN'
>    -> `SEGUKOOA'
>    -> `SEGY'
>    -> `XLS'
>    -> `ODS'
>    -> `XLSX'
>    -> `ElasticSearch'
>    -> `Walk'
>    -> `Carto'
>    -> `AmigoCloud'
>    -> `SXF'
>    -> `Selafin'
>    -> `JML'
>    -> `PLSCENES'
>    -> `CSW'
>    -> `VDV'
>    -> `GMLAS'
>    -> `MVT'
>    -> `TIGER'
>    -> `AVCBin'
>    -> `AVCE00'
>    -> `NGW'
>    -> `HTTP'
> 
> Thank you in advance
> 
> Mncedi
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 



More information about the gdal-dev mailing list