I have to create a class in C# in which I would like to insert a function that converts an ESRI personal geodatabase, extracting that features it contains in shp using OGR. I looked at library documentation and I saw that ogr2ogr can do the job. It looks to me that this utility is based on the command line. How can I embed its functions in a C# script?


Does the ogr2ogr command work? An easy one would be to run it from C#. Otherwise you can use the C# SWIG bindings, if you can get these for your programming environment with PGeo support.

If you are using GDAL 1.x use OGR_DS_CopyLayer/OGRDataSource::CopyLayer (or whatever it is called in the C# bindings). Or if you are using GDAL 2.x, use GDALDatasetCopyLayer.

The idea is you open a PGeo dataset/layer, create/open a shapefile dataset, then copy the layer(s) (i.e. shapefile) between the two.

  • I managed to get it to work with the command line but I would like to use C# bindings. I manage to create something with OGR.Driver.CreateDataSource but I can't see any output. When should I use Copy Layer? On the Extracted data Source? and after that How does the output path need to be set? Assuming I want to test the function output locally on my C drive? – user3523583 Feb 12 '15 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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