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 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?

-------------Problems Reply------------

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.

Category:c# Views:10 Time:2011-08-06

Related post

  • How to buffer an IPoint or IGeometry? (How to do buffered intersection checks on an IPoint?) 2010-05-10

    How would I buffer an IPoint to do an intersection check using IRelationalOperator? I have, for arguments sake: IPoint p1 = xxx; IPoint p2 = yyy; IRelationalOperator rel1 = (IRelationalOperator)p1; if (rel.Intersects (p2)) // Do something But now I w

  • Intersect two layers and get resulting features 2011-08-01

    I have X layers on a map and I need to intersect chosen layers (two per time) and color resulting features. I'm trying to get this code working // get first feature (index 0) ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature = m_firstLayer.GeometryFro

  • How to know if a line intersects a plane in C#? - Basic 2D geometry 2008-08-27

    my school maths are very rusty and I think this is a good opportunity to take advance of this community :D I have two points (a line) and a rectangle, I would like to know how to calculate if the line intersects the rectangle, my first approach had s

  • How to test if a line segment intersects an axis-aligned rectange in 2D? 2008-09-19

    How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points. --------------Solutions------------- The original poster wanted

  • Union and Intersect in Django 2008-09-20

    class Tag(models.Model): name = models.CharField(maxlength=100) class Blog(models.Model): name = models.CharField(maxlength=100) tags = models.ManyToManyField(Tag) Simple models just to ask my question. I wonder how can i query blogs using tags in tw

  • Code or formula for intersection of two parabolas in any rotation 2008-09-24

    I am working on a geometry problem that requires finding the intersection of two parabolic arcs in any rotation. I was able to intesect a line and a parabolic arc by rotating the plane to align the arc with an axis, but two parabolas cannot both alig

  • What is the standard SQL Query to retrieve the intersection of tables? 2008-09-29

    Selecting the union: select * from table1 union select * from table1_backup What is the query to select the intersection? --------------Solutions------------- In SQL Server intersect select * from table1 intersect select * from table1_backup SELECT *

  • How do I determine the intersection point of two lines in GDI+? 2008-09-30

    I'm using .NET to make an application with a drawing surface, similar to Visio. The UI connects two objects on the screen with Graphics.DrawLine. This simple implementation works fine, but as the surface gets more complex, I need a more robust way to

  • How do I extract a 2D slice from 3D geometry from plane intersection? 2008-10-16

    Recently our team was facing the task to build the 2D slice between a plane and some set of 3D geometry (set of triangles). Google hasn't been as helpful as we have wanted it to be, so we turn our attention here to see if anyone has encountered this

  • Find number range intersection 2008-10-22

    What is the best way to find out whether two number ranges intersect? My number range is 3023-7430, now I want to test which of the following number ranges intersect with it: <3000, 3000-6000, 6000-8000, 8000-10000, >10000. The answer should be

  • The intersection point between a spline and a line 2008-10-24

    I'm trying to find a way to calculate the intersection between a b-spline and a straight line. So far Google hasn't been much help. --------------Solutions------------- A pure mathematical approach: Transform the spline and the line so that the line

  • Algorithm to find if two sets intersect 2008-10-29

    Let's say I have two arrays: int ArrayA[] = {5, 17, 150, 230, 285}; int ArrayB[] = {7, 11, 57, 110, 230, 250}; Both arrays are sorted and can be any size. I am looking for an efficient algorithm to find if the arrays contain any duplicated elements b

  • Program to simulate vehicles at an intersection using queues 2008-11-16

    HI I got this coursework question to solve. This is the question: Design a program to simulate vehicles at an intersection. Assume that there is one lane going in each of four directions, with stoplights facing each direction. Vary the arrival time o

  • A range intersection algorithm better than O(n)? 2008-11-19

    Range intersection is a simple, but non-trivial problem. Its has been answered twice already: The first solutions

  • What is the fastest way to find the point of intersection between a ray and a polygon? 2008-11-23

    Pretty much as the question asks. Answers preferably in pseudo code and referenced. The correct answer should value speed over simplicity. --------------Solutions------------- See Intersections of Rays, Segments, Planes and Triangles in 3D. You can f

  • Intersection of two lines defined in (rho/theta ) parameterization 2008-12-20

    Have created a c++ implementation of the Hough transform for detecting lines in images. Found lines are represented using rho, theta, as described on wikipedia: "The parameter r represents the distance between the line and the origin, while θ is the

  • Efficient maths algorithm to calculate intersections 2008-12-22

    For a game I am developing I need an algorithm that can calculate intersections. I have solved the problem, but the way I have done it is really nasty and I am hoping someone here might have a more elegant solution. A pair of points represent the end

  • Circle-Rectangle collision detection (intersection) 2008-12-30

    How can I tell whether a circle and a rectangle intersect in 2D Euclidean space? (i.e. classic 2D geometry) --------------Solutions------------- Your insight is good, but it can be simplified. There are only two cases when the circle intersects with

  • Improve coding with List Intersect using Net 3.5 2009-01-15

    I've a class that has a list of IDs with a function for adding new IDs from a list of objects. I've got this resolved, but I'm sure this can be done with much less code. Public Class Page Private _IdList As List(Of Integer) Private _HasNewItems As Bo

Copyright (C), All Rights Reserved.

processed in 0.088 (s). 11 q(s)