geodabase file

01-03-2019 06:54 PM
New Contributor


I need to generate Geodabase file (not database but file on filesystem).

Can anyone advise how it can be done within a java application?

Thanks in advance.

0 Kudos
1 Reply
Occasional Contributor II

I can't give a working Java code, but in C# it looks like this (below). However, it won't create a file, the result is a folder. It is a totally empty GDB.

private static Geodatabase CreateFileGDB(string GDBPath)

// Test the argument:

const string NameOfGDBPath = nameof(GDBPath);
if (string.IsNullOrWhiteSpace(GDBPath))
throw new ArgumentNullException(NameOfGDBPath, "Geodatabase path cannot be null; empty or whitespace-only string.");

DirectoryInfo directoryInfo = new DirectoryInfo(GDBPath);

if (!directoryInfo.Parent.Exists)
throw new DirectoryNotFoundException("The parent directory (" + directoryInfo.Parent.FullName + ") was not found!");

if (directoryInfo.Exists)

//Create the GDB:

return Geodatabase.Create(directoryInfo.FullName);

0 Kudos