jczxl
路人甲
路人甲
  • 注册日期2005-01-09
  • 发帖数22
  • QQ
  • 铜币177枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1115回复:0

求助:图层属性字段拷贝问题?

楼主#
更多 发布于:2005-08-14 18:08
<P>我做图层叠加分析时候,不知道怎么设置CMOTableDesc的字段属性,新建图层倒是没问题,具体问题就是怎么把其他图层的字段拷贝到新建shp图层的属性字段上?</P>
<P>我自己的代码如下:</P>
<P>CMoRecordset RGeoDataset=rsourcelayer.GetRecords();<BR> CMoTableDesc RtableDesc=RGeoDataset.GetTableDesc();</P>
<P>for(int k=0;k<RfieldsCount-2;k++)<BR>  {      <BR>    CMoField Rfield(Rfields.Item(COleVariant(RtableDesc.GetFieldName(k))));<BR>   long type=RtableDesc.GetFieldType(k);<BR>   CString name=Rfield.GetName();<BR>   tableDesc.SetFieldName(k,name);<BR>      tableDesc.SetFieldType(k,type);  <BR>   short Fieldlength=RtableDesc.GetFieldLength(k);<BR>   tableDesc.SetFieldLength(k,Fieldlength);<BR>      <BR>  },然后</P>
<P>  VARIANT v1;<BR>  v1.vt = VT_BOOL;<BR>  v1.bVal = FALSE;</P>
<P>CMoGeoDataset geoDataset(conn.AddGeoDataset(layername,moPoint,tableDesc,v1,v1));<BR>   CMoMapLayer layer;<BR>   if(!layer.CreateDispatch(TEXT("MapObjects2.MapLayer")))<BR>   return ;<BR>   layer.SetGeoDataset(geoDataset);</P>
<P>这个时候就出现问题了!在dbf文件中,没有属性字段!何解?</P>
喜欢0 评分0
游客

返回顶部