24小时热门版块排行榜    

查看: 1313  |  回复: 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家族族长

【答案】应助回帖

引用回帖:
Originally posted by zzahkj at 2011-04-22 09:47:38:
我现在加了一句pFeatureClass1.CreateFeature()
这次属性表中有数据  可图上不显示?

属性中有数据有什么用啊?又不是显示属性数据。显示的是空间数据,你空间信息都没有赋值,怎么能显示呢?
10楼2011-04-22 21:24:50
已阅   回复此楼   关注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的Mz6后的代码验证其规律 +29 医学老男孩 2026-08-13 63/3150 2026-08-15 22:12 by 医学老男孩
[基金申请] filecode=后面第一个是大写字母 +6 wangze12014 2026-08-14 7/350 2026-08-15 20:12 by gltch
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +8 majunge000 2026-08-11 10/500 2026-08-15 18:55 by Equinoxhua
[基金申请] filecode +8 cratir 2026-08-14 12/600 2026-08-15 18:08 by zyfgau
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +12 Tide man 2026-08-10 13/650 2026-08-15 16:34 by 氺木
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +7 Ldrop2023 2026-08-13 7/350 2026-08-15 15:57 by mzhh2000
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 22/1100 2026-08-14 23:45 by Noways
[基金申请] 应该是93bebmhtak前后十一个字符比较关键 +23 Lanmanbaby 2026-08-09 37/1850 2026-08-14 13:40 by Equinoxhua
[硕博家园] 请教兼职经验 +3 是阿文鸭 2026-08-09 3/150 2026-08-14 12:07 by HER12025
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +10 家与远方 2026-08-10 15/750 2026-08-14 02:08 by 绵羊哥哥
[文学芳草园] 阿姨 +4 汪汪锅 2026-08-09 4/200 2026-08-13 19:43 by arzu_hma
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] 分享一下我之前已中青C的计划书的filecode +4 布布和一二 2026-08-11 5/250 2026-08-13 12:56 by cratir
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 帮忙看看fileCode +7 wwncly 2026-08-10 13/650 2026-08-11 19:36 by 冰心玉壶晴
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
信息提示
请填处理意见