ITopologicalOperator.Intersect,这是如何工作的?

发布于 2024-11-28 09:41:43 字数 1379 浏览 2 评论 0原文

我试图将一个层的所有功能与另一个层的所有功能相交,但在执行“ConstructUnion”函数时,我的 Web ADF 应用程序卡住了

这是我到目前为止编写的代码

// create a geometrybag for layer1
ESRI.ArcGIS.Geometry.IGeometry geometryBag = new ESRI.ArcGIS.Geometry.GeometryBagClass();
geometryBag.SpatialReference = m_firstLayerFirstfeatureIGeometry.SpatialReference;
ESRI.ArcGIS.Geometry.IGeometryCollection geometryCollection = (ESRI.ArcGIS.Geometry.IGeometryCollection)geometryBag;
// Cycle all features of first layer and add them to the collection
foreach (DataRow m_dr in m_firstLayerfeatureGraphics.Rows)
{
    // Takes this feature's geometry
    ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature =
        m_firstLayerfeatureGraphics.GeometryFromRow(m_dr) as ESRI.ArcGIS.ADF.Web.Geometry.Geometry;
    // convert to a igeometry object
    ESRI.ArcGIS.Geometry.IGeometry m_tempfeatureIGeometry =
    ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Local.Converter.ToIGeometry(adfFeature, ctx);
    System.Diagnostics.Debug.WriteLine("m_firstLayerfeatureGraphics +1 ");
    object missing = Type.Missing;
    geometryCollection.AddGeometry(m_tempfeatureIGeometry, ref missing, ref
    missing);
}
ESRI.ArcGIS.Geometry.ITopologicalOperator mtopo1 = new ESRI.ArcGIS.Geometry.PolygonClass();
// FOLLOWING LINE BLOCKS APPLICATION
mtopo1.ConstructUnion((ESRI.ArcGIS.Geometry.IEnumGeometry)geometryBag);

知道为什么吗?

I'm trying to intersect all features of a layer with another's but I'm getting the web ADF application stuck while executing the "ConstructUnion" function

Here's the code I've written so far

// create a geometrybag for layer1
ESRI.ArcGIS.Geometry.IGeometry geometryBag = new ESRI.ArcGIS.Geometry.GeometryBagClass();
geometryBag.SpatialReference = m_firstLayerFirstfeatureIGeometry.SpatialReference;
ESRI.ArcGIS.Geometry.IGeometryCollection geometryCollection = (ESRI.ArcGIS.Geometry.IGeometryCollection)geometryBag;
// Cycle all features of first layer and add them to the collection
foreach (DataRow m_dr in m_firstLayerfeatureGraphics.Rows)
{
    // Takes this feature's geometry
    ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature =
        m_firstLayerfeatureGraphics.GeometryFromRow(m_dr) as ESRI.ArcGIS.ADF.Web.Geometry.Geometry;
    // convert to a igeometry object
    ESRI.ArcGIS.Geometry.IGeometry m_tempfeatureIGeometry =
    ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Local.Converter.ToIGeometry(adfFeature, ctx);
    System.Diagnostics.Debug.WriteLine("m_firstLayerfeatureGraphics +1 ");
    object missing = Type.Missing;
    geometryCollection.AddGeometry(m_tempfeatureIGeometry, ref missing, ref
    missing);
}
ESRI.ArcGIS.Geometry.ITopologicalOperator mtopo1 = new ESRI.ArcGIS.Geometry.PolygonClass();
// FOLLOWING LINE BLOCKS APPLICATION
mtopo1.ConstructUnion((ESRI.ArcGIS.Geometry.IEnumGeometry)geometryBag);

Any idea why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜心 2024-12-05 09:41:44

正如该网站的GIS版本所述,这就是解决方案

您需要创建 ArcObject 实例(GeometryBagClass 位于
开始和 PolygonClass 靠近代码片段的末尾)
ArcGIS Server SOC 通过使用 IServerContext.CreateObject。您当前的
代码在 Web 服务器上(或 ADF 应用程序的任何位置)创建这些对象
正在运行),这需要大量的编组,在许多情况下
似乎永远不会完成。

您已经在 ctx 中拥有对服务器上下文的引用
变量,所以你基本上已经准备好了。一旦所有的 ArcObjects 都被
在 ArcGIS Server 上创建后,您的问题可能会得到解决。

As stated in GIS version of this website, this is the solution

You need to create the ArcObject instances (GeometryBagClass at the
beginning and PolygonClass near the end of your code snippet) on the
ArcGIS Server SOC by using IServerContext.CreateObject. Your current
code creates these objects on the web server (or wherever your ADF app
is running), which requires a lot of marshalling which in many cases
seems to never finish.

You already have the reference to the server context in the ctx
variable, so you are basically all set. Once all the ArcObjects are
created on the ArcGIS Server, your problem is likely to be solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文