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
ESRI.ArcGIS.Geometry.ITopologicalOperator mtopo1 = new ESRI.ArcGIS.Geometry.PolygonClass();

Any idea why?

  • Is there any COM error message or does it really just sit on that line forever? – blah238 Aug 7 '11 at 20:27
  • It just sits on that line forever. Occasionally everything crashes with no error (w3smp.exe crash or something like that) – Marco A. Aug 8 '11 at 16:12

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.