Closed michkowalczuk closed 12 months ago
I suspect a usage issue. Are there non-ASCII characters in the value of GDAL_DATA? If so, you need to UTF-8 encode the string
I suspect a usage issue. Are there non-ASCII characters in the value of GDAL_DATA? If so, you need to UTF-8 encode the string
The actual string is "D:\Projects\geopackage\sp-geopackage-import\bin\share\gdal", so that's not the problem.
Can you write dxf with GDAL binaries?
ogr2ogr -f dxf test.dxf test.json
That works for me and my gdal_data seems to be GDAL_DATA=C:\OSGeo4W\apps\gdal\share\gdal
Might be good to test if the issue affects also the binaries or just the code.
Can you write dxf with GDAL binaries?
ogr2ogr -f dxf test.dxf test.json
That works for me and my gdal_data seems to beGDAL_DATA=C:\OSGeo4W\apps\gdal\share\gdal
Might be good to test if the issue affects also the binaries or just the code.
I use Conda distribution (not OSGeo4W) and using ogr2ogr
by default get the same error. If I set GDAL_DATA environment variable in windows it fails with different error:
ERROR 1: DXF layer does not support arbitrary field creation, field 'EntityHand' not created.
This means that GDALCreate
passes. (I use the same path as I try in the code.)
It also means that setting env variable manually is a solution for ogr2ogr but not dor using dlls.
How about backslashes, what if they are considered to mean escapes? Have you tried with forward ones, or with double \\
?
How about backslashes, what if they are considered to mean escapes? Have you tried with forward ones, or with double
\\
?
Tested all possible combinations. As I mentioned at the beginning, GDAL can recognize PROJ_DATA
path, but GDAL_DATA
no in my case.
I would double check that PROJ_DATA works even if it is in D:\Projects\geopackage\sp-geopackage-import\bin\share\proj
. Or maybe it is already, I just don't know.
I would double check that PROJ_DATA works even if it is in
D:\Projects\geopackage\sp-geopackage-import\bin\share\proj
. Or maybe it is already, I just don't know.
Yes, it is. I have 2 separate folders ...\share\proj (PROJ_DATA)
and ...\share\gdal (GDAL_DATA)
.
Dose somebody know why GDAL uses "gdal"
argument in CPLFindFile
function, not "gdal_data"
when looking for "header.dxf"
?
Maybe this is some clue?
Dose somebody know why GDAL uses
"gdal"
argument inCPLFindFile
function,
No, this is normal. Cf https://github.com/OSGeo/gdal/blob/0fe09b61d751916623e53252e51047ec40853814/port/cpl_findfile.cpp#L166
Something's wrong in your setup, but I'm not sure what
Dose somebody know why GDAL uses
"gdal"
argument inCPLFindFile
function,No, this is normal. Cf
Something's wrong in your setup, but I'm not sure what
Yes, it looks strange.
Notice that I did not get "Cannot find %s (GDAL_DATA is not defined)"
error from 169 line.
It means that CPLGetConfigOption("GDAL_DATA", nullptr))
returns something (True), so GDAL_DATA
is probably set correctly...
I found it! The problem is on the string conversion side. I'm working on Delphi wrapper for GDAL and convert Delphi string to C char*.
So far the conversion below has worked:
Result := PUTF8Char(AnsiString(aStr));
After changing the conversion function to use UTF8String instead of AnsiString, it started working. :-)
Result := PUTF8Char(UTF8String(aStr));
Expected behavior and actual behavior.
Can not write a DXF file because of the following error:
Steps to reproduce the problem.
I use
CPLSetConfigOption
to pass'GDAL_DATA'
config option and set path toshare\gdal
folder. This folder definitely containsheader.dxf
file.Then I check the config option using
GetEnvironmentVariable('GDAL_DATA')
. Method returns me the same path I passed before.GDALCreate
returns NULL and returns the above error.Furthermore, I programmatically set environmental variable using SetEnvironmentVariable from WIN API with no effect.
EDIT: I must add that using the same method I add
PROJ_DATA
and GDAL findsproj.db
.Operating system
Windows 11 x64
GDAL version and provenance
GDAL 3.7.2 C API