FileGDB API for linux 学习系列之四,XML Schema of Geodatabase
2011-03-03 14:45
453 查看
从很早以前(至少从ArcGIS9.2包括9.2)ESRI的桌面产品就提供了将空间数据导成XML文件的功能,如下图,
可以选择只将数据库的schema的结构导出,也可以选择将数据也一并导出。到现在的FileGDB API继续沿用这一架构。在FileGDB API中提供了很多
操作Schema内容的函数,如:
操作Domain的函数:
CreateDomain(const std::string &domainDef) //创建域
AlterDomain(const std::string &domainDef) //改变域
DeleteDomain(const std::string &domainDef) //删除域
操作表的函数:
AddField(std::string &fieldDef) //添加字段
AlterField(std::string &fieldDef)//改变字段
DeleteField(std::string &fieldDef)//删除字段
操作子类的函数:
CreateSubtype(std::string &subtypeDef) //创建子类
AlterSubtype(std::string &subtypeDef)//改变子类
DeleteSubtype(std::string &subtypeDef)//删除子类
等等,所有的牵扯到Schema中对象的定义,修改,删除等函数的参数,都是XML格式,当然这些XML格式并不能随便写,必须得按照ESRI的规范
进行书写,具体规范在FileGDB API的doc文件中的XML_Schema_of_Geodatabase-3.pdf中有详细的介绍。以下是常用的几种对象的定义规范:
1. 字段的定义
以下是XML表示的Field例子:
esriFieldTypeSmallInteger
esriFieldTypeInteger
esriFieldTypeSingle
esriFieldTypeDouble
esriFieldTypeString
esriFieldTypeDate
esriFieldTypeOID
esriFieldTypeGeometry
esriFieldTypeBlob
esriFieldTypeRaster
esriFieldTypeGUID
esriFieldTypeGlobalID
esriFieldTypeXML
3. 索引的定义
XML例子表示:
SubType的XML的结构图:
XML的例子:
先举着这些例子吧,居然别的类型,可以查看pdf文件。
可以选择只将数据库的schema的结构导出,也可以选择将数据也一并导出。到现在的FileGDB API继续沿用这一架构。在FileGDB API中提供了很多
操作Schema内容的函数,如:
操作Domain的函数:
CreateDomain(const std::string &domainDef) //创建域
AlterDomain(const std::string &domainDef) //改变域
DeleteDomain(const std::string &domainDef) //删除域
操作表的函数:
AddField(std::string &fieldDef) //添加字段
AlterField(std::string &fieldDef)//改变字段
DeleteField(std::string &fieldDef)//删除字段
操作子类的函数:
CreateSubtype(std::string &subtypeDef) //创建子类
AlterSubtype(std::string &subtypeDef)//改变子类
DeleteSubtype(std::string &subtypeDef)//删除子类
等等,所有的牵扯到Schema中对象的定义,修改,删除等函数的参数,都是XML格式,当然这些XML格式并不能随便写,必须得按照ESRI的规范
进行书写,具体规范在FileGDB API的doc文件中的XML_Schema_of_Geodatabase-3.pdf中有详细的介绍。以下是常用的几种对象的定义规范:
1. 字段的定义
以下是XML表示的Field例子:
<Field xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:esri='http://www.esri.com/schemas/ArcGIS/10.1' xsi:type='esri:Field'> <Name>nightName> <Type>esriFieldTypeStringType> <IsNullable>trueIsNullable> <Length>4Length> <Precision>0Precision> <Scale>0Scale> <AliasName>dayAliasName> <ModelName>nightModelName> <DefaultValue xsi:type="xs:string">afternoonDefaultValue> Field>
其中Type元素定义了字段的类型,FileGDB API一共提供了13种数据类型,分别是
esriFieldTypeSmallInteger
esriFieldTypeInteger
esriFieldTypeSingle
esriFieldTypeDouble
esriFieldTypeString
esriFieldTypeDate
esriFieldTypeOID
esriFieldTypeGeometry
esriFieldTypeBlob
esriFieldTypeRaster
esriFieldTypeGUID
esriFieldTypeGlobalID
esriFieldTypeXML
2. 表的定义
XML例子如下:
xml version="1.0" encoding="UTF-8"?> <esri:DataElement xmlns:esri='http://www.esri.com/schemas/ArcGIS/10.1'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xsi:type='esri:DETable'> <CatalogPath>/StreetInfoCatalogPath> <Name>StreetInfoName> <MetadataRetrieved>trueMetadataRetrieved> <Metadata xsi:type='esri:XmlPropertySet'> <XmlDoc> <?xml version="1.0"?> <metadata xml:lang="en"><Esri><CreaDate>20101215</CreaDate><CreaTime>13025800</CreaTime><ArcGISFormat>1.0</ArcGISFormat><SyncOnce>TRUE</SyncOnce></Esri></metadata> XmlDoc> Metadata> <DatasetType>esriDTTableDatasetType> <Versioned>falseVersioned> <CanVersion>falseCanVersion> <ConfigurationKeyword>ConfigurationKeyword> <HasOID>trueHasOID> <OIDFieldName>OBJECTIDOIDFieldName> <Fields xsi:type='esri:Fields'> <FieldArray xsi:type='esri:ArrayOfField'> <Field xsi:type='esri:Field'> <Name>OBJECTIDName> <Type>esriFieldTypeOIDType> <IsNullable>falseIsNullable> <Length>4Length> <Precision>0Precision> <Scale>0Scale> <Required>trueRequired> <Editable>falseEditable> <DomainFixed>trueDomainFixed> <AliasName>OBJECTIDAliasName> <ModelName>OBJECTIDModelName> Field> <Field xsi:type='esri:Field'> <Name>NameName> <Type>esriFieldTypeStringType> <IsNullable>trueIsNullable> <Length>50Length> <Precision>0Precision> <Scale>0Scale> <AliasName>NameAliasName> <ModelName>NameModelName> <DefaultValue xsi:type='xs:string'>DefaultValue> Field> <Field xsi:type='esri:Field'> <Name>StreetTypeName> <Type>esriFieldTypeIntegerType> <IsNullable>trueIsNullable> <Length>4Length> <Precision>0Precision> <Scale>0Scale> <AliasName>StreetTypeAliasName> <ModelName>StreetTypeModelName> <DefaultValue xsi:type='xs:double'>1DefaultValue> Field> <Field xsi:type='esri:Field'> <Name>WidthName> <Type>esriFieldTypeDoubleType> <IsNullable>trueIsNullable> <Length>8Length> <Precision>0Precision> <Scale>0Scale> <AliasName>WidthAliasName> <ModelName>WidthModelName> <DefaultValue xsi:type='xs:double'>25.0DefaultValue> Field> <Field xsi:type='esri:Field'> <Name>LastPavedName> <Type>esriFieldTypeDateType> <IsNullable>trueIsNullable> <Length>8Length> <Precision>0Precision> <Scale>0Scale> <AliasName>LastPavedAliasName> <ModelName>LastPavedModelName> <DefaultValue xsi:type='xs:dateTime'>2000-01-01T00:00:00DefaultValue> Field> FieldArray> Fields> <Indexes xsi:type='esri:Indexes'> <IndexArray xsi:type='esri:ArrayOfIndex'> <Index xsi:type='esri:Index'> <Name>FDO_OBJECTIDName> <IsUnique>trueIsUnique> <IsAscending>trueIsAscending> <Fields xsi:type='esri:Fields'> <FieldArray xsi:type='esri:ArrayOfField'> <Field xsi:type='esri:Field'> <Name>OBJECTIDName> <Type>esriFieldTypeOIDType> <IsNullable>falseIsNullable> <Length>4Length> <Precision>0Precision> <Scale>0Scale> <Required>trueRequired> <Editable>falseEditable> <DomainFixed>trueDomainFixed> <AliasName>OBJECTIDAliasName> <ModelName>OBJECTIDModelName> Field> FieldArray> Fields> Index> IndexArray> Indexes> <CLSID>{7A566981-C114-11D2-8A28-006097AFF44E}CLSID> <EXTCLSID>EXTCLSID> <RelationshipClassNames xsi:type='esri:Names'>RelationshipClassNames> <AliasName>TestTableAliasName> <ModelName>ModelName> <HasGlobalID>falseHasGlobalID> <GlobalIDFieldName>GlobalIDFieldName> <RasterFieldName>RasterFieldName> <ExtensionProperties xsi:type='esri:PropertySet'> <PropertyArray xsi:type='esri:ArrayOfPropertySetProperty'>PropertyArray> ExtensionProperties> <ControllerMemberships xsi:type='esri:ArrayOfControllerMembership'>ControllerMemberships> esri:DataElement>
3. 索引的定义
XML例子表示:
<esri:Index xsi:type='esri:Index' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:esri='http://www.esri.com/schemas/ArcGIS/10.1'> <Name>StreetTypeIdxName> <IsUnique>falseIsUnique> <IsAscending>trueIsAscending> <Fields xsi:type='esri:Fields'> <FieldArray xsi:type='esri:ArrayOfField'> <Field xsi:type='esri:Field'> <Name>StreetTypeName> <Type>esriFieldTypeSmallIntegerType> <IsNullable>falseIsNullable> <Length>2Length> <Precision>0Precision> <Scale>0Scale> <Required>trueRequired> <Editable>falseEditable> <DomainFixed>trueDomainFixed> <AliasName>StreetTypeAliasName> <ModelName>StreetTypeModelName> Field> FieldArray> Fields> esri:Index>
SubType的XML的结构图:
XML的例子:
<esri:Subtype xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs=http://www.w3.org/2001/XMLSchema
xmlns:esri="http://www.esri.com/schemas/ArcGIS/10.1" xsi:type="esri:Subtype"> <SubtypeName>subtype threeSubtypeName> <SubtypeCode>99SubtypeCode> <FieldInfos xsi:type="esri:ArrayOfSubtypeFieldInfo"> <SubtypeFieldInfo xsi:type="esri:SubtypeFieldInfo"> <FieldName>percentCompleteFieldName> <DomainName>sampleRangeDomainDomainName> <DefaultValue xsi:type="xs:double">56DefaultValue> SubtypeFieldInfo> FieldInfos> esri:Subtype>
先举着这些例子吧,居然别的类型,可以查看pdf文件。
相关文章推荐
- FileGDB API for linux 学习系列之二,编译Display例子程序
- FileGDB API for linux学习系列之三,检索目录树
- FileGDB API for linux 学习系列之一,编译例子程序
- FileGDB API for linux 学习系列之六,对象的创建
- FileGDB API for linux学习之八,空间数据解析库
- FileGDB API for linux 学习之七,数据的查询
- File GeoDatabase API学习
- arcgis for android: file:/mnt/sdcard/xxx.geodatabase does not exist.
- Issue 71 - pymssql - Undefined symbols on Mac, CentOS, Redhat with pre-compiled build - A fast MS SQL Server client library for Python directly using C API instead of ODBC. It is Python DB-API 2.0 compliant. Works on Linux, *BSD, Solaris, Mac OS X and Win
- HBase异常:hbase-default.xml file seems to be for and old version of HBase的解决方法
- Sharepoint学习笔记—Site Definition系列-- 4、相对快捷地创建List Definition的Schema.xml文件
- XML错误信息Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-4.0.xsd). For more information, right click on the message in the Problems View ...
- 学习J2EE第5天(Simple API for XML)
- File GeoDatabase API简介
- curl出现Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Pl
- hbase-default.xml file seems to be for an older version of HBase ,this version is 1.2.0
- hbase启动报错hbase-default.xml file seems to be for and old version of HBase
- No signature of method: static org.gradle.api.java.archives.Manifest.srcFile() is applicable for arg
- 无法启动Hbase hbase-default.xml file seems to be for and old version of HBase
- ErrorException: curl_setopt(): The usage of the @filename API for file uploading is deprecated.