I can successfully execute the following command in the OSGeo4W shell:
ogr2ogr -f "PostgreSQL" -a_srs "EPSG:102733" PG:"host=localhost user='postgres' dbname='nameofdb' password='password' port=5433" "Water and Sewer Map.dxf" -nln eastover
but whenever I open up a blank Windows CMD and navigate to the folder where my file is and run the same command, I get this:
Unable to find driver `PostgreSQL'.
But when I run this in the Windows CMD:
I get this:
GDAL 2.0.1, released 2015/09/15
My goal is to have this as a batch file so I can run it from the native CMD prompt. Why is it saying the I don't have the PostgreSQL driver on the Windows CMD and how to I fix it?
Per AlecZ's recommendation, I have taken the o4w_env.bat script and appended my command to the end to look like this:
REM Make parent of this script location our current directory, REM converting UNC path to drive letter if needed pushd %~dp0 cd .. REM set OSGEO4W_ROOT to short path version set OSGEO4W_ROOT="C:\OSGeo4W64" REM start with clean path set path=%OSGEO4W_ROOT%\bin;%WINDIR%\system32;%WINDIR%;%WINDIR%\WBem;%OSGEO4W_ROOT%\share for %%f in ("%OSGEO4W_ROOT%\etc\ini\*.bat") do call "%%f" popd cd network share:\folder\folder\folder ogr2ogr -f "PostgreSQL" -a_srs "EPSG:102733" PG:"host=localhost user='username' dbname='databasename' password='password' port=5433" "Water and Sewer Map.dxf" -nln eastover pause
But now I am getting this error:
ERROR 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files. ERROR 1: Failed to process SRS definition: EPSG:102733
I have updated the environment variable as suggested in the error and added
;%OSGEO4W_ROOT%\share to the end of the clean path setting, but neither seems to be working. Any other suggestions?