Is it possible to cast a segment of polyline feature into a line feature??

341
1
08-21-2013 11:56 AM
Hari_PrasathPalani
New Contributor
I would like to know If my touch is on a line or not. I could not figure out how to do it with polyline. If I can cast each segment into a line, then I can check it using "Y= mx + c". But I am not able to get individual segment from my polyline and I dont see any functions in the SDK to acheive this.
Does anyone have any idea on how to
1. Cast segment of polyline into a line?
2. Or, check if a point is on a polyline or not?

Any help is greatly appreciated.
0 Kudos
1 Reply
DanO_Neill
Occasional Contributor III
You use the GeometryEngine.touches() method to detemine if one geometry touches another geometry.  A simple example:

Geometry baseGeom = new Point(-130, 10);
Polyline polyline = new Polyline();
polyline.startPath(new Point(-130, 10));
polyline.lineTo(-131, 15);
polyline.lineTo(-140, 20);

boolean isTouched = GeometryEngine.touches(baseGeom, polyline, sr);


Where sr is a valid spatial reference for the geometries.
0 Kudos