开发者

ITopologicalOperator.Intersect, how does this work?

I'm trying to intersect all features of a layer with another's but I'm getting the web 开发者_如何学GoADF 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜