Select to view content in your preferred language

Lines Intersect, but cannot get a Point that intersects them?

940
2
Jump to solution
09-18-2019 06:49 AM
JamesKennedy1
Occasional Contributor

Hello,

Attached is a photo of my code, with the exception that it is having.

Essentially I have two lines. One line going through many, many smaller lines (thousands).

Some of the smaller lines I want to label.

So the first step in finding these lines is finding a character code, which I do and find them easily.

The second step is to get the intersecting point between the smaller line and the larger line.

I follow the examples and first I need to check if they intersect, so they do.

Then I try to get an IntersectingPoint and bam - it's null.

What am I doing wrong?

bool intersects = GeometryEngine.Instance.Intersects(featureXS.GetShape(), feature.GetShape()); // intersects = true

if (intersects == true) {
var IntersectingGeometryPoints = GeometryEngine.Instance.Intersection(featureXS.GetShape(), feature.GetShape()) as Multipoint;
MapPoint intPoint = IntersectingGeometryPoints.Points[0];

Polyline needOriginPointFromGeom = featureXS.GetShape() as Polyline;

for(int i = 0; i < needOriginPointFromGeom.PointCount; i++) {
if(needOriginPointFromGeom.Points == intPoint) {
xsPoints.Add(new XsPoint((int)featureXS.GetObjectID(), cursorXSRow.FindField("XS_LETTER"), intPoint, needOriginPointFromGeom.Points[i-1]));
}

}


}

0 Kudos
1 Solution

Accepted Solutions
JamesKennedy1
Occasional Contributor

Ha, looks like I didn't see the examples too closely. I just needed to add GeometryDimension.esriGeometry0Dimension

and it fixed!

var IntersectingGeometryPoints = GeometryEngine.Instance.Intersection(featureXS.GetShape(), feature.GetShape(), GeometryDimension.esriGeometry0Dimension) as Multipoint;

View solution in original post

0 Kudos
2 Replies
JamesKennedy1
Occasional Contributor

Ha, looks like I didn't see the examples too closely. I just needed to add GeometryDimension.esriGeometry0Dimension

and it fixed!

var IntersectingGeometryPoints = GeometryEngine.Instance.Intersection(featureXS.GetShape(), feature.GetShape(), GeometryDimension.esriGeometry0Dimension) as Multipoint;

0 Kudos
YassineKha
Emerging Contributor

Hi,

Could you please share with me the example that you have worked with ... as I have the same task as I want to draw a line on the map that contains a tileLayer and get the intersect of the line with the TileLayer.

 

Could you please help me with that ?

Many thanks in  advance

 

0 Kudos