I am having issues importing a SHP file into SQLServer. The SHP file is EPSG 28354 (drawn in QGIS 3.x) and has these assoc files:

  • REE_ProjectAreas.cpg
  • REE_ProjectAreas.dbf
  • REE_ProjectAreas.prj
  • REE_ProjectAreas.shp
  • REE_ProjectAreas.shx

The ogr2ogr.exe I am using is from OSGeo4w v 3.3.1 (from https://trac.osgeo.org/osgeo4w) which installed itself into c:\OSGeo4w

the two Windows commands I am using are:

call c:\OSGeo4W\bin\o4w_env.bat

c:\OSgeo4w\bin\ogr2ogr.exe  -progress -f MSSQLSpatial  "MSSQL:server=HSLT_17;database=REE_DHSS;trusted_connection=yes"  "c:\temp\REE_ProjectAreas.shp"  -a_srs "ESPG:28354"

The error I get is:

ERROR 1: Failed to process SRS definition: ESPG:28354

if I remove the -a_srs "ESPG:28354" part then the SHP file gets imported but the SRID is incorrect in the assoc SQL tables that ogr2ogr creates and populates: enter image description here enter image description here

the contents of the o4w_env.bat is:

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
for %%i in ("%CD%") do set OSGEO4W_ROOT=%%~fsi

REM start with clean path
set path=%OSGEO4W_ROOT%\bin;%WINDIR%\system32;%WINDIR%;%WINDIR%\WBem
for %%f in ("%OSGEO4W_ROOT%\etc\ini\*.bat") do call "%%f"


After running that the path is pretty clean:


The contents of the REE_ProjectAreas.prj is:


i found:

“Cannot find proj.db” and "ERROR 1: PROJ: proj_create_from_database: cannot build geodeticCRS 4326" errors

but that is not quite the same. I am setting my path to be clean and only use c:\OSGeo4W\bin

Also tried ogr2ogr from within C:\Program Files\QGIS 3.10\bin, same problem.

Why does ogr2ogr not import the SHP into SQL with the correct EPSG?

1 Answer 1


You have a typo in your command, it should be:

c:\OSgeo4w\bin\ogr2ogr.exe  -progress -f MSSQLSpatial  "MSSQL:server=HSLT_17;database=REE_DHSS;trusted_connection=yes"  "c:\temp\REE_ProjectAreas.shp"  -a_srs "EPSG:28354"

That's EPSG not ESPG

  • duh, sorry, my bad. good catch ... works now.
    – LukeB
    Commented Sep 21, 2022 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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