logo资料库

用FME转DWG到SHP从原理到方法.doc

第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
资料共5页,全文预览结束
用 FME 转 DWG 到 SHP 从原理到方法 yjch2005 本文主要解决的问题是 dwg 格式中带有扩展属性(xdate),扩展属性里面有重要的数 据,是我们不能舍弃的,当然也有些没有扩展属性的(不是我们讨论的),一般自带的工 具无法转换扩展属性。以前解决的办法主要是编程,这个成本太高了,也很麻烦。现在说 的 fme 用它就可以解决这个问题的 本贴子从 dwg 数据存储方式,及 fme 转换的原理,并结合具体的数据,来说明。 有不足之处,还请各位指出。
Cad 格式的数据主要由以下几个部分组成 头(HEADER):是存储与图形有关的变量设置。 类(CLASSES):是存储与图形有关的类的定义 表(TABLES):主要是存储线型,颜色,层名等几何要素的 块(block):主要是定义符号和其它相关的图形文件 实体(ENTITIES):这是 cad 图形数据最主要和部分,每个实体包含了一些固定的信息,比 如它的颜色,层,线型,几何要素,以及每个实体特定的属性值,例如一个文本(text)实 体的字段有字体,大小,显示属性的字符串等。 对象 (objects):这部分存储字典和其它实体对象的说明 呵呵 现在说的是重点了啊,一般人不知道的,就是 cad 数据还有扩展属性的,用 xlist 命令 可以在 cad 中查看,这部分数据最大可以有 16k,你必须安装 autodesk 的提供的小工具 express 才可以查看的,大家为什么以前在转 dwg 到 shp 中,会发现没有属性,因为你的属性在扩 展(xdate)中,你用的软件没有办法读取 xdate 中的数据,不信各位打开 cass 查看。 现在来说说 fme 如果你有安装了 arcgis 的扩展模块的话 ,里面是有内置的 fme 引擎的 1.你必须是安装完全版的 2.在 extension 中勾选 Data Interoperability 模块 3.启动 ArcCatalog ,打开 ArctoolBox,新建一个 toolbox,右 toolbox(新建的)-new-Spatial ETL Tool ,ok 就会出现一个你以前没有见过的对话框。 4.输入 dwg,点 next,再输入 dwg 的目录,点 setting,会出现一个新的选项框,按需而选, 但是记住,bolck,expand into entities(意思是把每个实体打散)不要勾啊。ok!next,下 面的对话框就是你要转的目标格式。ok,会出现新的界面,就是 fme 的工作台了。 如果你有 fme 了设置的方法一样。 再来说说 fme 对 dwg 格式的处理原理吧 fme 读取文件概述 fme 的 The AutoCAD DWF reader 模块从 dwg 图形文件依次提取实体,并传递给 fme 的其它模块处理。复杂的实体如多段线(polylines )和插入的部分(insert)将被炸 开,分成若干独立的 fme 要素。如果实体拥有扩展属性,则也会被读取并放到相应 的要素中。 对 extend entity date(简称 xdate) 的处理 xdate 通常被应用程序用于存储属性数据。fme 为了 xdate 尽可能的简单易用,用了 三种不同的格式数据存储 fme 要素对象。前两种格式几乎不存储要素中的图形数据, 而第三种格式则以一种更易用方式存储属性数据。有一点必须指出的是,The AutoCAD DWF reader 模块在读取 xdate 数据的时侯,三种格式都存储在一个单独的 fme 要素中。xdate 只能在添加了说明后的格式(interpreted format),才能被 The AutoCAD writer 模块处理。xdate 将会被 fm 有重新调整,以 = 的格式输出。因为以这种形式便于 fme 的其它模块查看和读取。
在这种格式中,数据将会以列表的形式表示的。数据将存储在名为 named extended_data_list{}的单独列表中,列表中的每个值 以属性标签:属性值(: . )的形式表示。不过 fme 仅 支持以下几种 application_name autocad_layer string world_position world_displacement world_direction real distance scale 16Bit_integer 32Bit_integer 标签,属性标签决定了属性值的类型。。。。 特别说明,fme 并不存储与 xdate 相关的 AutoCAD codes 。 具体标签的说明如下 application_name The name of the application which the following entity data is associated. This application_name remains in effect until another application_name entry is specified. AutoCAD Code: 1001 Example: application_name:ACAD autocad_layer The name of the layer the extended data is associated. AutoCAD Code: 1003 Example: autocad_layer:Water string A character string value from 0 to 255 characters in length. AutoCAD Code: 1000 Example: string:Thompson Binary data A hexadecimal string from 0 to 254 characters in length. AutoCAD Code: 1004 Example: binary:E3B4 three_reals Three 64-bit real numbers separated by commas. AutoCAD Code: 1010,1020,1030 Example: three_reals:2.3,4.5,3.4 world_position Three real numbers which represent a world position. Each of the numbers is separated by a comma. AutoCAD Code: 1011, 1021, 1031 Example: world_position:23.4, -123.5, 0 world_displacement Three real values which represent a world displacement value.
Each of the values is separated by a comma. AutoCAD Code: 1012, 1022, 1032 Example: world_displacement:1.5, 2.3, 0 world_direction Three real values which represent a world direction vector. Each of the values is separated by a comma. AutoCAD Code: 1013,1023,1033 Example: world_direction: 30.0, -12.4, 10 real A 64-bit real number. AutoCAD Code: 1040 Example: real:3.1415926 distance A 64-bit real number which represents a distance. AutoCAD Code: 1041 Example: distance:4.56 scale A 64-bit real number which represents a scaling factor. AutoCAD Code: 1042 Example: scale:34.5 16Bit_integer A 16-bit integer value. AutoCAD Code: 1070 Example: 16Bit_integer:245 32Bit_integer A 32-bit integer value. AutoCAD Code: 1071 Example: 32Bit_integer:12983 具体的方法 现在举一个例子来说明,fme 对 xdate 为数据的处理方式 这是 AutoCAD 中 xdtae 中存储的数据, 格式是 符号代码 值 1001 1000 1000 1000 1000 C_NODE CONNOBJ_1=43F4 COUNT=3 CONNOBJ_2=43F3 CONNOBJ_3=43F2
1005 1010 1020 1030 1001 1000 163 45.4 -123.5 0 DPRINT postscript 而 fme 读取后在 fme 的 universal viewer 读取后则是以下列的形式出现 属性 值 extended_data_list{0} application_name:C_NODE extended_data_list{1} string:CONNOBJ_1=43F4 extended_data_list{2} string:COUNT=3 extended_data_list{3} string:CONNOBJ_2=43F3 extended_data_list{4} string:CONNOBJ_3=43F2 extended_data_list{5} handle:163 extended_data_list{6} three_reals:45.4,-123.5,0 extended_data_list{7} application_namePRINT extended_data_list{8} string:postscript 再用 dwg 的街坊数据的 JMD 这一层(cass 做的)来说明 街坊数据 我们需要转两个属性 实体代码 和 房屋层数 都是 xdate 中, 1.参照上述,把数据加载进来。 2.只选择 JMD 这层 3 然后 就是在源文件(左边的)上,右击 属性--format attribute 勾选 autocad_extended_list{ },ok 接着到 目标文件 (最右边的),右击 属性-format attribute 新建两个字段,stdm ,fwcs 在就是把一些不必要的元素的连接去掉,一般只要 点,线,面就好了 最后就是把源文件和 目标文件 的字段要对应好,建立正确的连接,然后就是不停的调试, 看输出的 shp 是否符合你的要求 如果是行的话 里面还有很多函数,供你使用的
分享到:
收藏