24小时热门版块排行榜    

查看: 1293  |  回复: 10
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zzahkj

木虫 (著名写手)

[求助] Vb.net+ArcEngine生成的点状图层不显示?

我刚刚接触这个,望高手给个详细解答,谢谢!我的代码如下,为什么我生成的点状图层不显示呢?
Dim pShpWksFact As IWorkspaceFactory = New ShapefileWorkspaceFactory()
            Dim pFeatWks As IFeatureWorkspace
            pFeatWks = CType(pShpWksFact.OpenFromFile(filePath, 0), IFeatureWorkspace)
            Const strShapeFieldName As String = "Shape"
            Dim pFields1 As IFields
            Dim pFieldsEdit1 As IFieldsEdit
            pFields1 = New FieldsClass()
            pFieldsEdit1 = CType(pFields1, IFieldsEdit)
            Dim pField1 As IField = New FieldClass()
            Dim pFieldEdit1 As IFieldEdit = New FieldClass()
            pFieldEdit1.Name_2 = strShapeFieldName
            pFieldEdit1.Type_2 = esriFieldType.esriFieldTypeGeometry
            pField1 = CType(pFieldEdit1, IField)
            Dim pGeomDef1 As IGeometryDef = New GeometryDefClass()
            Dim pGeomDefEdit1 As IGeometryDefEdit = New GeometryDefClass()
            pGeomDefEdit1 = CType(pGeomDef1, IGeometryDefEdit)
            pGeomDefEdit1.GeometryType_2 = esriGeometryType.esriGeometryPoint
            pGeomDefEdit1.SpatialReference_2 = Main.AxMapControl1.Map.SpatialReference
            pFieldEdit1.GeometryDef_2 = pGeomDef1
            pFieldsEdit1.AddField(pField1)
            pFields1 = CType(pFieldsEdit1, IFields)
            Dim pFeatureClass1 As IFeatureClass
            pFeatureClass1 = pFeatWks.CreateFeatureClass("点", pFields1, Nothing, Nothing, esriFeatureType.esriFTSimple, strShapeFieldName, "" )
            Dim pPointCol As IPointCollection = New MultipointClass()

            Dim sr As StreamReader = New StreamReader(My.Computer.FileSystem.CurrentDirectory & "\shu\dianceng.txt" )

            Dim str As String = sr.ReadLine()
            Dim own As Long = 0
            While str IsNot Nothing
                Dim strs() As String = Regex.Split(str, "        " )
                Dim x As Double = Convert.ToDouble(strs(0))
                Dim y As Double = Convert.ToDouble(strs(1))
                 Dim pPoint As IPoint = New PointClass()
                pPoint.X = x
                pPoint.Y = y
                Dim missing As Object = Type.Missing
                pPointCol.AddPoint(pPoint, missing, missing)
                str = sr.ReadLine()
            End While
Main.AxMapControl1.AddShapeFile(filePath, "点" )

[ Last edited by zzahkj on 2011-4-19 at 23:29 ]
回复此楼
不要迷恋哥,哥只是一个过客!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yanggis

木虫 (著名写手)

小木虫GIS家族族长

【答案】应助回帖

zzahkj(金币+9): 1 2011-04-28 14:03:05
engine 中编辑数据要从StartEditing开始,然后Creat feature,然后写入属性。最后Stopediting(true),保存编辑才行。
5楼2011-04-21 19:50:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

zzahkj

木虫 (著名写手)

太不给力了,没人理!
不要迷恋哥,哥只是一个过客!
2楼2011-04-21 09:52:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xiangling1

金虫 (正式写手)

【答案】应助回帖

zzahkj(金币+1): 2011-04-28 14:02:48
应该是后面的程序问题,你生成的点集没有添加到图层当中!
Dim pPointCol As IPointCollection = New MultipointClass()
......
pPointCol.AddPoint(pPoint, missing, missing);
后面应该加东西
黄沙百战穿金甲,不破楼兰终不还!
3楼2011-04-21 18:59:13
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yanggis

木虫 (著名写手)

小木虫GIS家族族长

【答案】应助回帖

如果你仅仅就这一个数据集,那就到ArcMap中直接生成显示就可以了。没必要写程序。如果有很多数据集》100个。可以自己先学一下再做。没有调试环境,没法给你说哪里错了。
4楼2011-04-21 19:49:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] FileCode能看出啥? +6 要乐观耀哥 2026-08-10 12/600 2026-08-10 18:37 by wmfsnow
[基金申请] filecode +7 documentary 2026-08-10 7/350 2026-08-10 18:32 by GZUZM
[基金申请] 为什么网上很多人说本周 12号出结果 +3 瞬息宇宙 2026-08-10 3/150 2026-08-10 18:27 by Tide man
[基金申请] 确定了,国自然21号放榜 +5 布布和一二 2026-08-10 6/300 2026-08-10 18:03 by Tide man
[基金申请] 关于Filecode分析方法 +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[基金申请] 奇怪,两个人的filecode固定段从头到尾一模一样 +4 布布和一二 2026-08-10 4/200 2026-08-10 14:50 by 医学老男孩
[基金申请] 8月时间戳变的,举个手。玩一下,释放压力 +11 archvillain 2026-08-04 13/650 2026-08-10 14:41 by seekfind
[基金申请] 据悉今年马上要出结果了 +7 瞬息宇宙 2026-08-10 8/400 2026-08-10 12:42 by Vivilian
[基金申请] 2026国自然放榜时间 +9 布布和一二 2026-08-08 9/450 2026-08-10 11:22 by xxxx2020
[基金申请] 这样的filecode谁见过 +11 布布和一二 2026-08-08 22/1100 2026-08-10 11:10 by wmfsnow
[基金申请] fileCode有新解读? +10 Tide man 2026-08-08 18/900 2026-08-09 12:55 by 仁砚薪传
[基金申请] 关于filecode,很负责任的告诉大家 +6 爱看书的可乐 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[基金申请] 关于豆爷回答的JTJC与%2F数量 +5 yang182083 2026-08-06 7/350 2026-08-08 18:29 by zhanghaozhu
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] 关于filecode +4 布布和一二 2026-08-07 7/350 2026-08-07 22:55 by zhanghaozhu
[基金申请] 化学口download_prp&fileCode的固定段好像这几天一直没变,有变的大神么? +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[基金申请] filecode +14 等待解的谜 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
[基金申请] filecode +8 布布和一二 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
[基金申请] 有没有H口的?有收到消息的吗? +3 超级海虾 2026-08-04 3/150 2026-08-04 17:26 by 学教育滴
[基金申请] 纯娱乐,不喜欢勿喷 +7 Tide man 2026-08-04 10/500 2026-08-04 15:10 by loufangrui
信息提示
请填处理意见