阅读:2994回复:1
请问斑竹,怎么把Mapinfo的表转为MicroStation的dgn,且保证其图数一致!
<P>我有一mapinfo表Building,有一Name字段,欲转为Dgn,且想保持其图形和数据在转换过程中关系不丢失,应如何操作!</P>
<P>如mapinfo有一Building,表中name字段char(50)</P> <P>MicroStation有一Access外部数据库,有MsLink字段 integer,Name char(50)</P> <P>mapinfo中Building表的图斑1(如RowID=1)为line的高速公路,表中name字段记为“高速公路”,希望转为dgn后msLink为1,同时新生成Access的库中Building的name字段也为“高速公路”且msLink为1,即保证其转换后仍能查到其属性信息!</P> [此贴子已经被作者于2006-3-30 23:08:37编辑过]
|
|
1楼#
发布于:2006-04-02 11:34
对于FME支持Microstation的写方式,有两种模式,一种是直接写dgn格式,然后在脚本文件中控制dgn的linkage属性,把属性数据关联上;另外一种是写Geographics的模式(包括MGE),这样可以定义外部数据库,把图形数据都生成。<br><br>对于第一种模式,需要把mapinfo的数据库保存成dbf格式,后面给出一个例子:<br>__________________________________________________________________<br><br>LOG_FILENAME fme.log<br>WRITER_TYPE IGDS<br>READER_TYPE SHAPE<br># Stuff the IGDS Writer needs to know about.<br>IGDS_DATASET test.dgn<br>IGDS_SEED_FILE seed2d.dgn<br># Stuff the SHAPE reader needs to know about.<br>SHAPE_DATASET<br># Filename of the tracts table.<br>Relate TABLE_LOCATION tractTab tracttab.dbf<br><br>#---------------------------------------------------------------<br># Macros for IGDS<br>MACRO fillUserId 65<br>MACRO fillMagic 67586<br>#---------------------------------------------------------------<br># Color macros -- nice names for an IGDS Color Map<br>MACRO white 0<br>MACRO blue 1<br>MACRO green 2<br>MACRO red 3<br>MACRO yellow 4<br>MACRO magenta 5<br>MACRO orange 6<br>MACRO turq 7<br>MACRO black 8<br>MACRO grey 9<br>MACRO darkGreen 114<br>MACRO cyan 121<br>MACRO purple 125<br>MACRO indianRed 83<br>MACRO baise 84<br>MACRO medPurple 85<br>MACRO darkGray 144<br>MACRO seventies 164<br>MACRO brown 126<br>MACRO desktop 159<br>MACRO nt 95<br>MACRO bisque 217<br><br>#---------------------------------------------------------------<br># This lookup table maps the county FIPS number to a color.<br>Lookup CntyFipsToColorLUT \<br>035 $(bisque) \<br>013 $(nt) \<br>117 $(desktop) \<br>223 $(brown) \<br>247 $(seventies) \<br>077 $(medPurple) \<br>297 $(baise) \<br>217 $(darkGreen) \<br>113 $(orange) \<br>097 $(turq) \<br>151 $(purple) \<br>255 $(cyan) \<br>057 $(grey) \<br>063 $(darkGray) \<br>135 $(magenta) \<br>067 $(indianRed) \<br>089 $(blue) \<br>121 $(red)<br><br># ---------------------------------------------------------------<br># The IGDS auxiliary attribute table definition and relation<br># definition.<br>Relate TABLE_DEF tractTab DBF \<br>I_AREA number(12,3) \<br>I_AREA2 number(12,5) \<br>I_PERIM number(12,3) \<br>I_PERIM2 number(12,5) \<br>I_TRACT_ID number(11,0) \<br>I_STATE_FP char(2) \<br>I_CNTY_FP char(3) \<br>I_TRACT char(6) \<br>I_CNTY_TRT char(9) \<br>I_SQ_MILES number(11,3)<br><br># Note that in the relation definition the functions @Area and<br># @Length are used to compute values for the table fields I_AREA2<br># and I_PERIM2 when the relation is used to output to the table.<br>Relate RELATION_DEF tractRelation 1:1 \<br>TABLE tractTab \<br>UNIQUE(I_TRACT_ID) \<br>JOIN I_TRACT_ID TO TRACT_ID \<br>TRANSFER I_AREA TO AREA \<br>TRANSFER I_PERIM TO PERIMETER \<br>TRANSFER I_AREA2 TO @Area() \<br>TRANSFER I_PERIM2 TO @Length() \<br>TRANSFER I_TRACT_ID TO TRACT_ \<br>TRANSFER I_STATE_FP TO STATE_FIPS \<br>TRANSFER I_CNTY_FP TO CNTY_FIPS \<br>TRANSFER I_TRACT TO TRACT \<br>TRANSFER I_CNTY_TRT TO CNTY_TRACT \<br>TRANSFER I_SQ_MILES TO SQ_MILES<br><br># ---------------------------------------------------------------<br># The Shape definition<br>SHAPE_DEF tracts SHAPE_GEOMETRY shape_polygon \<br>AREA number(12,3) \<br>PERIMETER number(12,3) \<br>TRACT_ number(11,0) \<br>TRACT_ID number(11,0) \<br>STATE_FIPS char(2) \<br>CNTY_FIPS char(3) \<br>TRACT char(6) \<br>CNTY_TRACT char(9) \<br>SQ_MILES number(11,3)<br><br># ---------------------------------------------------------------<br># Transfer specification for these features<br># On the shape side, the @Relate will retrieve values from the IGDS<br># attribute table into the Shape feature when shape is the<br># destination, and when we are reading from shape is the source<br># the @Relate will output values to the IGDS attribute table.<br>#<br># Notice that the %tract_id transfer variable is stored in both the<br># graphic_group and the linkage_2_key attributes.<br># This allows the tract_id to be easily viewed in microstation<br>SHAPE tracts \<br>TRACT_ID %tract_id \<br>CNTY_FIPS %fips \<br>@Relate(tractRelation, Read)<br>IGDS 32 \<br>igds_type igds_shape \<br>igds_color $(green) \<br>igds_weight 1 \<br>igds_graphic_group %tract_id \<br>igds_linkage{0}.type user \<br>igds_linkage{0}.userId $(fillUserId) \<br>igds_linkage{0}.long{0} $(fillMagic) \<br>igds_linkage{0}.long{1} @Lookup(CntyFipsToColor-<br>LUT,%fips) \<br>igds_linkage{1}.type dbase \<br>igds_linkage{1}.key %tract_id<br>__________________________________________________________<br><br><br>以上是生成dgn格式的数据的时候,来控制linkage属性保持和源数据的属性数据一致(可以参见fme readers and writers中关于design file reader/writer的部分)。<br><br>对于写成Geographics的方式,可以参见fme readers and writers中关于Intergraph MGE Reader/Writer的部分。
|
|