【问题标题】:Clip two Shape with Mapwingis : Resulting shapefile has no shapes使用 Mapwingis 剪辑两个形状:生成的 shapefile 没有形状
【发布时间】:2015-09-14 09:58:49
【问题描述】:

我的代码使用 MapWingis.ocx

我使用 MapWingis.Shapefile 来声明一个“Shapefile”对象

我只想剪辑两个 shapefile。有一个API函数格式:

Shapefile.Clip (bool SelectedOnlySubject, Shapefile sfOverlay, bool SelectedOnlyOverlay)

我开始写这个。

    Dim sfOverlay As New MapWinGIS.Shapefile
    Dim sfinput As New MapWinGIS.Shapefile
    Dim sfClip As New MapWinGIS.Shapefile
    Dim index1 As Integer
    Dim index2 As Integer

        index1 = CbBInputLayer.SelectedIndex
        index2 = CbBOverlayClipLayer.SelectedIndex
        sfinput = FormMain.AxMapMain.get_Shapefile(index1)
        sfOverlay = FormMain.AxMapMain.get_Shapefile(index2)

    sfClip = sfinput.Clip(False, sfOverlay, False)
        If sfClip Is Nothing Then
            MessageBox.Show("Failed to calculate Clip :" + sfinput.ErrorMsg(sfinput.LastErrorCode))
            MessageBox.Show("Failed to calculate Clip :" + sfOverlay.ErrorMsg(sfOverlay.LastErrorCode))
            MessageBox.Show("Failed to calculate Clip :" + sfClip.ErrorMsg(sfClip.LastErrorCode))

        Else
            shape2.Add(sfClip)
        End If

结果is Nothingand

sfInput give 生成的 shapefile 没有形状

sfOverlay给出没有错误

sfClip空引用设置为对象的实例

我该如何解决这个问题?有错吗?

【问题讨论】:

  • 你试过CatfoodCodePlex吗?
  • 我会试试的,是不是要从 Mapwingis.shapefile 中更改 sfInputsfOverlaysfClip 的声明? @OneFineDay
  • 这是一个SDK,用于打开和访问形状文件元素。我用它来读取多边形,然后将它们绘制在地图上。它做得更多......

标签: vb.net visual-studio-2012 dictionary shapes shapefile


【解决方案1】:

这段代码没有错。我的错误是我用来输入和剪辑它的地图。感谢cmets

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-14
    • 2013-12-07
    • 2022-01-22
    相关资源
    最近更新 更多