I recently did a clean window installed. I installed OSGeo4W via: https://trac.osgeo.org/osgeo4w/ I installed GDAL by downloading the pip wheel GDAL-2.3.2-cp36-cp36m-win_amd64.whl I also configured my django settings.py to:
if os.name == 'nt':
import platform
import sys
OSGEO4W = r"C:\OSGeo4W"
if '64' in platform.architecture()[0]:
OSGEO4W += "64"
assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W
os.environ['OSGEO4W_ROOT'] = OSGEO4W
os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal"
os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']
GDAL_LIBRARY_PATH = sys.path[6] + r'\osgeo\gdal203.dll'
This configuration worked on my previous machine but when trying to edit a django model with a Point field I would get this error:
GDAL_ERROR 4: b'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 transforming geometry from srid '4326' to srid '3857' (OGR failure.)
GDAL_ERROR 4: b'Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.'
Internal Server Error: /admin/event/event/31/change/
I followed the same configuration as my previous setup. Same machine but new OS so I'm a bit stomped. How can I configure the GDAL_DATA env variable? I tried the suggestion:
https://stackoverflow.com/a/52597276/9469766
setting GDAL:
GDAL_DATA= OSGEO4W + r'\share\gdal'
and
GDAL_DATA= OSGEO4W + r'\share\epsg_csv'
but both still produced the same exception.