File Geodatabase API
|
A class representing a File Geodatabase. More...
Public Member Functions | |
Schema browsing | |
fgdbError | GetDatasetTypes (std::vector< std::wstring > &datasetTypes) const |
Gets a list of the dataset types in the geodatabase. More... | |
fgdbError | GetDatasetRelationshipTypes (std::vector< std::wstring > &relationshipTypes) const |
Gets a list of relationship types in the geodatabase. More... | |
fgdbError | GetChildDatasets (const std::wstring &parentPath, const std::wstring &datasetType, std::vector< std::wstring > &childDatasets) const |
Gets the child datasets for a particular dataset, if any. More... | |
fgdbError | GetRelatedDatasets (const std::wstring &path, const std::wstring &relType, const std::wstring &datasetType, std::vector< std::wstring > &relatedDatasets) const |
Gets the related datasets for a particular dataset, if any. More... | |
Schema definition | |
fgdbError | GetDatasetDefinition (const std::wstring &path, const std::wstring &datasetType, std::string &datasetDef) const |
Gets the definition of a dataset as an XML document. More... | |
fgdbError | GetChildDatasetDefinitions (const std::wstring &parentPath, const std::wstring &datasetType, std::vector< std::string > &childDatasetDefs) const |
Gets the definitions of child datasets as a collection of XML documents. More... | |
fgdbError | GetRelatedDatasetDefinitions (const std::wstring &path, const std::wstring &relType, const std::wstring &datasetType, std::vector< std::string > &relatedDatasetDefs) const |
Gets the definitions of related datasets as a collection of XML documents. More... | |
fgdbError | GetDatasetDocumentation (const std::wstring &path, const std::wstring &datasetType, std::string &documentation) const |
Gets the metadata of a dataset as XML. More... | |
Datasets | |
fgdbError | CreateFeatureDataset (const std::string &featureDatasetDef) |
Creates a new feature dataset. More... | |
fgdbError | CreateFeatureDataset (const std::wstring &path, const SpatialReference &spatialReference) |
Creates a new feature dataset. More... | |
fgdbError | CreateTable (const std::string &tableDef, const std::wstring &parent, Table &table) |
Creates a new table. More... | |
fgdbError | CreateTable (const std::wstring &path, const std::vector< FieldDef > &fieldDefs, const std::wstring &configurationKeyword, Table &table) |
fgdbError | OpenTable (const std::wstring &path, Table &table) |
Opens a table. More... | |
fgdbError | CloseTable (Table &table) |
Closes a table that has been previously created or opened. More... | |
fgdbError | Rename (const std::wstring &path, const std::wstring &datasetType, const std::wstring &newName) |
Renames a dataset. More... | |
fgdbError | Move (const std::wstring &path, const std::wstring &newParentPath) |
Moves a dataset from one container to another. More... | |
fgdbError | Delete (const std::wstring &path, const std::wstring &datasetType) |
Deletes a dataset. More... | |
fgdbError | CompactDatabase () |
Compacts the geodatabase. More... | |
Domains | |
fgdbError | GetDomains (std::vector< std::wstring > &domainNames) const |
Gets the names of all domains, if any. More... | |
fgdbError | CreateDomain (const std::string &domainDef) |
Creates a domain. More... | |
fgdbError | AlterDomain (const std::string &domainDef) |
Modifies the properties of an existing domain. More... | |
fgdbError | DeleteDomain (const std::wstring &domainName) |
Deletes the specified domain. More... | |
fgdbError | GetDomainDefinition (const std::wstring &domainName, std::string &domainDef) const |
Gets the definition of the specified domain. More... | |
SQL | |
fgdbError | GetQueryName (const std::wstring &path, std::wstring &queryName) const |
Gets the query name (the name to use in SQL statements) of a table based on its path. More... | |
fgdbError | ExecuteSQL (const std::wstring &sqlStmt, bool recycling, EnumRows &rows) const |
Executes a SQL statement on the geodatabase. More... | |
Constructors and Destructors | |
Geodatabase () | |
The class constructor. | |
~Geodatabase () | |
The class destructor. | |
A class representing a File Geodatabase.
fgdbError FileGDBAPI::Geodatabase::GetDatasetTypes | ( | std::vector< std::wstring > & | datasetTypes | ) | const |
Gets a list of the dataset types in the geodatabase.
[out] | datasetTypes | The dataset types in the geodatabase. |
fgdbError FileGDBAPI::Geodatabase::GetDatasetRelationshipTypes | ( | std::vector< std::wstring > & | relationshipTypes | ) | const |
Gets a list of relationship types in the geodatabase.
[out] | relationshipTypes | The relationship types in the geodatabase. |
fgdbError FileGDBAPI::Geodatabase::GetChildDatasets | ( | const std::wstring & | parentPath, |
const std::wstring & | datasetType, | ||
std::vector< std::wstring > & | childDatasets | ||
) | const |
Gets the child datasets for a particular dataset, if any.
If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | parentPath | The dataset to find the children of, e.g. "\usa". |
[in] | datasetType | The child dataset type as a wstring, e.g. "Feature Class". Passing in an empty string will return all child datasets. DatasetType |
[out] | childDatasets | The children of the parent dataset, if any. |
fgdbError FileGDBAPI::Geodatabase::GetRelatedDatasets | ( | const std::wstring & | path, |
const std::wstring & | relType, | ||
const std::wstring & | datasetType, | ||
std::vector< std::wstring > & | relatedDatasets | ||
) | const |
Gets the related datasets for a particular dataset, if any.
If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | path | The path of the dataset to find related datasets for, e.g. "\usa\streets_topology". |
[in] | relType | The relationship type to filter return values with, e.g. "DatasetInFeatureDataset". Passing in an empty string will return all related datasets. RelationshipType |
[in] | datasetType | The type of the dataset to find related datasets for. DatasetType |
[out] | relatedDatasets | The origin dataset's related datasets, if any. |
fgdbError FileGDBAPI::Geodatabase::GetDatasetDefinition | ( | const std::wstring & | path, |
const std::wstring & | datasetType, | ||
std::string & | datasetDef | ||
) | const |
Gets the definition of a dataset as an XML document.
If the dataset does not exist, this will fail with an error code of -2147220655 (The table was not found). If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | path | The requested dataset's path. e.g. "\usa\city_anno" |
[in] | datasetType | The requested dataset's type as a string, e.g. "Table". DatasetType |
[out] | datasetDef | The dataset's definition as an XML document. |
fgdbError FileGDBAPI::Geodatabase::GetChildDatasetDefinitions | ( | const std::wstring & | parentPath, |
const std::wstring & | datasetType, | ||
std::vector< std::string > & | childDatasetDefs | ||
) | const |
Gets the definitions of child datasets as a collection of XML documents.
If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | parentPath | The parent dataset's path, e.g. "\usa". |
[in] | datasetType | The parent dataset's type as a string, e.g. "Feature Dataset". Passing in an empty string will return all child datasets. DatasetType |
[out] | childDatasetDefs | A collection of child dataset definitions, if any. |
fgdbError FileGDBAPI::Geodatabase::GetRelatedDatasetDefinitions | ( | const std::wstring & | path, |
const std::wstring & | relType, | ||
const std::wstring & | datasetType, | ||
std::vector< std::string > & | relatedDatasetDefs | ||
) | const |
Gets the definitions of related datasets as a collection of XML documents.
If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | path | The origin dataset's path, e.g. "\usa\streets_topology" |
[in] | relType | The relationship type to filter return values with, e.g. "DatasetInFeatureDataset". RelationshipType |
[in] | datasetType | The origin dataset's type as a string, e.g. "Relationship Class". Passing in an empty string will return all related datasets. DatasetType |
[out] | relatedDatasetDefs | A collection of related dataset definitions, if any. |
fgdbError FileGDBAPI::Geodatabase::GetDatasetDocumentation | ( | const std::wstring & | path, |
const std::wstring & | datasetType, | ||
std::string & | documentation | ||
) | const |
Gets the metadata of a dataset as XML.
If a non-existent path is provided, a -2147211775 (The item was not found) error will be returned.
[in] | path | The requested dataset's path. e.g. "\address_list" |
[in] | datasetType | The requested dataset's type as a string, e.g. "Table". DatasetType |
[out] | documentation | The dataset's metadata as XML. |
fgdbError FileGDBAPI::Geodatabase::CreateFeatureDataset | ( | const std::string & | featureDatasetDef | ) |
Creates a new feature dataset.
If the feature dataset already exists, a -2147220733 (The dataset already exists) error will be returned.
If the feature dataset name is missing from the XML, a -2147220645 (INVALID_NAME) error will be returned.
If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
XML
[in] | featureDatasetDef | The XML definition of the feature dataset to be created. |
fgdbError FileGDBAPI::Geodatabase::CreateFeatureDataset | ( | const std::wstring & | path, |
const SpatialReference & | spatialReference | ||
) |
Creates a new feature dataset.
If the feature dataset already exists, a -2147220733 (The dataset already exists) error will be returned.
[in] | path | The name of the feature dataset to be created. |
[in] | spatialReference | The spatial reference of the feature dataset to be created. |
fgdbError FileGDBAPI::Geodatabase::CreateTable | ( | const std::string & | tableDef, |
const std::wstring & | parent, | ||
Table & | table | ||
) |
Creates a new table.
This can either be a table or a feature class. If a geometry is to support Zs or Ms (measures), HasZ and or HasM must be set to true in the GeometryDef in the XML. The ZOrigin, MOrigin, ZScale and MScale must also be set in the SpatialReferences in the XML. These do not default. See the samples\XMLsamples\FC_GCS_LineMin.xml for an example. Domain definitions in the table XML definition will be ignored. Use Table.AlterField to assign a domain. If the table already exists, a -2147220653 (The table already exists) error will be returned.
If the table name is missing from the XML, a -2147220654 (The table name is invalid) error will be returned.
If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).
XML-TableXML-Feature Class XML-Feature Class with the minimum spatial reference definition XML-Feature Class to be created in a feature dataset
[in] | tableDef | The XML definition of the table to be created. |
[in] | parent | The location where the table will be created. Pass an empty string if you want to create a table or feature class at the root. If you want to create a feature class in an existing feature dataset use the path "\USA". |
[out] | table | A Table instance for the newly created table. |
fgdbError FileGDBAPI::Geodatabase::CreateTable | ( | const std::wstring & | path, |
const std::vector< FieldDef > & | fieldDefs, | ||
const std::wstring & | configurationKeyword, | ||
Table & | table | ||
) |
[in] | path | The path of the table to create. If creating a table or feature class at the root make sure to include "\". If creating a feature class in a feature dataset include the feature dataset name in the path "\USA\counties". |
[in] | fieldDefs | The field definitions of the table to be created. |
[in] | configurationKeyword | The configuration keyword of the table to be created. If a empty string or unknown keyword is entered, the DEFAULTS keyword is used. Configuration Keywords |
[out] | table | A Table instance for the newly created table. |
fgdbError FileGDBAPI::Geodatabase::OpenTable | ( | const std::wstring & | path, |
Table & | table | ||
) |
Opens a table.
This can also be used to open attributed and M:N relationship class tables. If the table does not exist, a -2147220655 (The table was not found) error will be returned. Attempting to open a compressed file is not supported and a -2147220109 (FileGDB compression is not installed.) error will be returned.
[in] | path | The path of the table to open. Opening a table or feature class at the root make sure to include "\". If opening a feature class in a feature dataset include the feature dataset name in the path "\USA\counties". |
[out] | table | An Table instance for the opened table. |
fgdbError FileGDBAPI::Geodatabase::CloseTable | ( | Table & | table | ) |
Closes a table that has been previously created or opened.
[in] | table | The table to close. |
fgdbError FileGDBAPI::Geodatabase::Rename | ( | const std::wstring & | path, |
const std::wstring & | datasetType, | ||
const std::wstring & | newName | ||
) |
Renames a dataset.
[in] | path | The path of the dataset, e.g. "\Landbase\Parcels". |
[in] | datasetType | The requested dataset's type as a string, e.g. "Table". DatasetType |
[in] | newName | The name to apply to the dataset, e.g. "Parcels2". |
fgdbError FileGDBAPI::Geodatabase::Move | ( | const std::wstring & | path, |
const std::wstring & | newParentPath | ||
) |
Moves a dataset from one container to another.
[in] | path | The path of the dataset to move, e.g. "\Landbase\Parcels". |
[in] | newParentPath | The path of the container the dataset will be moved to, e.g. "\LandUse". |
fgdbError FileGDBAPI::Geodatabase::Delete | ( | const std::wstring & | path, |
const std::wstring & | datasetType | ||
) |
Deletes a dataset.
If a the dataset does not exist, this will fail with an error code of -2147219118 (A requested row object could not be located).
If you do not have delete access to the dataset, this will fail with an error code of E_FAIL.
[in] | path | The path of the dataset to delete, e.g. "\Owners". |
[in] | datasetType | The requested dataset's type as a string, e.g. "Table". DatasetType |
fgdbError FileGDBAPI::Geodatabase::CompactDatabase | ( | ) |
Compacts the geodatabase.
fgdbError FileGDBAPI::Geodatabase::GetDomains | ( | std::vector< std::wstring > & | domainNames | ) | const |
Gets the names of all domains, if any.
[out] | domainNames | The domains. |
fgdbError FileGDBAPI::Geodatabase::CreateDomain | ( | const std::string & | domainDef | ) |
Creates a domain.
If the XML is not UTF-8, create will fail with an error code of -2147024809 (Invalid function arguments).
If the domain name already exists, a -2147209212 (Domain name already in use) error will be returned.
XML - Coded Value Domain XML - Range Domain
[in] | domainDef | The XML definition of the domain to be created. |
fgdbError FileGDBAPI::Geodatabase::AlterDomain | ( | const std::string & | domainDef | ) |
Modifies the properties of an existing domain.
If the XML is not UTF-8, create will fail with an error code of -2147024809 (Invalid function arguments).
[in] | domainDef | The modified XML definition of the domain. |
fgdbError FileGDBAPI::Geodatabase::DeleteDomain | ( | const std::wstring & | domainName | ) |
Deletes the specified domain.
If the domain does not exist, this will fail with an error code of -2147209215 (The domain was not found).
[in] | domainName | The name of the domain to delete. |
fgdbError FileGDBAPI::Geodatabase::GetDomainDefinition | ( | const std::wstring & | domainName, |
std::string & | domainDef | ||
) | const |
Gets the definition of the specified domain.
[in] | domainName | The name of the domain. |
[out] | domainDef | The XML definition of the domain. |
fgdbError FileGDBAPI::Geodatabase::GetQueryName | ( | const std::wstring & | path, |
std::wstring & | queryName | ||
) | const |
Gets the query name (the name to use in SQL statements) of a table based on its path.
[in] | path | The path of the dataset that will be queried. |
[out] | queryName | The name that should be used for the table in SQL statements. |
fgdbError FileGDBAPI::Geodatabase::ExecuteSQL | ( | const std::wstring & | sqlStmt, |
bool | recycling, | ||
EnumRows & | rows | ||
) | const |
Executes a SQL statement on the geodatabase.
This may or may not return a result set. A DELETE without a WHERE clause will result in a truncate. If the SQL statement is invalid, an -2147220985 (An invalid SQL statement was used) error will be returned.
[in] | sqlStmt | The SQL statement to be executed. |
[in] | recycling | Indicates whether the row enumerator should recycle memory. |
[out] | rows | An enumerator of rows or a null value. |