ITopologicalOperator.Cut() fails at some polylines (randomly?)

870
2
08-23-2011 11:21 PM
SebastianKrings
Occasional Contributor
Hi,

I am going to cut a Line (a route, Polyline) by a set of ContourLines stores in a PolylineFeatureClass.
For every left and right, which the cut method creates, I recursively cut again.
A cut is done for every contourFeature in the featureClass (nexted through a loop) until a cut was successfull. After I got left and right, they are also simplified.

Wit a small set of data, it works fine. But when using a bigger dataset the cut method throws an exception that there's missing an object refrence (think sth. is null). I debugged it and none of my objects are null (left and right are out params). And it fails every at the same position, on contour #148.

When I delete this single contourLine the next fail is on contour #199. Then came #204, #205, #206, #258, #328 (of overall 340)
Then I took just some selections of contourLines.

Here are some which WORKED:
1) #148, #199, #204, #205, #206, #258, #328
2)#123 - #150 (#148 included)
3) any other selection like (2) when start position is higher than #123
3)#1 - #150 (#148 excluded)
4) #1 - #340 (all bad lines excluded)

Here are some which NOT WORKED:
1) #122-#150 (#148 included)
2) like (1) just with lower startposition
3) #1 - #340 (one or many of the bad lines included)

some of the bad lines are closed, some not (isCloses means its a ring, not a path)
some of the bad lines crosses the route, some not (some will cross more than once)

I dont know what to check where to look or what else to found out
- what is the problem
- how can I solve it
- or what alternative do I have?

a little discussion or the solution^^ would be very nice

Thanks for help!
0 Kudos
2 Replies
DubravkoAntonic
New Contributor III
try ITopologicalOperator.Simplify()
http://resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esrigeometry/ITopologicalOperator2.htm

But be aware that it will modify your Polyline making geometry topologicaly correct, see the pictures from desktop SDK is picture that describes
0 Kudos
SebastianKrings
Occasional Contributor
yeah I still do so:

After I got left and right, they are also simplified.


the wy it modifies paths is ok, becaus I have a straight route.

But it will gain problems when I have a route which uses a street twice, wont it?
So I have a PolylineClass with a single polyline feature to be cut.
Let the route go from A to D. in the mid directly from A top D lies C. From C a way goes away to B.
The route goes now from A to C to B, back to C and then further to D. The way from C to B is used twice (vice versa). What will simplify do with this? Becaus I have just one feature.
0 Kudos