How to create a new file geodatabase


This sample will demonstrate the how to create a new file geodatabase stored with a .gdb extension.
 

How to use

  1. Paste the function in your project.
  2. Call the function from your code.
[VCPP]
// Creates a new File Geodatabase in the specified location.
HRESULT createFileGDBWorkspace(BSTR location, BSTR name, IWorkspaceName
  **ppOutWorkspaceName)
{
  if (ppOutWorkspaceName == NULL)
    return E_POINTER;

  IWorkspaceFactoryPtr ipWorkspaceFactory(CLSID_FileGDBWorkspaceFactory);
  return ipWorkspaceFactory->Create(location, name, NULL, NULL,
    ppOutWorkspaceName);
}






Development licensing Deployment licensing
Engine Developer Kit Engine