Hi All,
Here's what happens:
Next, I confirmed which version of gdal ships with the Pro environment, and it is gdal 3.4.0:
Then, as a test, I created a new, non-ESRI conda environment and installed gdal 3.4.0 in it by running conda install gdal=3.4.0, and that worked, i.e., ogr2ogr works fine from a gdal installation in the non-ESRI environment, but I get the "dll not found" errors when running from the ESRI environment.
I looked in environment folder that contains ogr2ogr.exe and, lo and behold, the 3 dll files are in the non-ESRI environment version of gdal, but not in the ESRI environment version.
Any reason why the ESRI environment doesn't load these DLLs with gdal? Would it mess things up if I simply copied the 3 DLLs over from the non-ESRI installation of gdal over to the ESRI installation?
Also, I didn't always have this problem--I believe it has only come up since updating to Pro 3.0.
Thanks,
Pro has their own distribution of the packages. have a look
import osgeo
dir(osgeo)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_gdal', 'config_file',
... SNIP ...
'this_python_version_will_be_deprecated_in_gdal_version', 'ver_str', 'version_info', 'winreg']
from osgeo import gdal
dir(gdal)
['AbortPendingUploads', 'AllRegister', 'ApplyGeoTransform', 'ApplyVerticalShiftGrid', 'AsyncReader', 'Attribute',
... SNIP ...
'wrapper_GDALVectorTranslateDestDS', 'wrapper_GDALVectorTranslateDestName', 'wrapper_GDALWarpDestDS', 'wrapper_GDALWarpDestName']
I see, that might explain why the DLL files aren't in the Pro distribution. Is there some other way to run ogr2ogr commands from within a Pro environment? E.g, does osgeo.gdal have any methods equivalent to running ogr2ogr in the command line?
Ultimately, I want to convert OSM files to SHP files. Ogr2ogr is previously how I've done this.
have a look when you import it and do a dir... I snipped out a huge chunk of the methods, and I don't know which one you are using,
Thanks Dan. A quick scan of the methods from osgeo.gdal didn't reveal anything that obviously seemed like a substitute for ogr2ogr, but as you said there are a lot of them to sift through. I googled around for "arcgis pro gdal" to see if there's a method reference somewhere, but nothing obvious. Will report back if I find anything.
There was a change at Pro 2.9: https://pro.arcgis.com/en/pro-app/2.9/get-started/whats-new-in-arcgis-pro.htm#ESRI_SECTION1_546A5C80...
Does this help?
Interesting to know, but alas does not directly address the issue. As Dan said, Pro uses a different installation of GDAL, which apparently lacks the DLLs needed to run ogr2ogr command line. The link you provided is specific to the gdal python module (not command line ogr2ogr). As Dan and I's thread above describes, my hope is that perhaps there's a way to run ogr2ogr through the python gdal methods, but figuring that out seems time-consuming and will require some sifting through GDAL's API reference.