Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using ArcGIS WPF's Polyline to plot several lines (PointCollections). Adding a Path(PointCollection) looks something like this.

PointCollection collection = new PointCollection();
PolyLine myLine = new PolyLine();



PolyLine is a Geometry in which I can set to a Graphic and plot on a map. Once that Graphic is clicked it of course is clicking the entire graphic. I am visually showing several Paths(PointCollections). Is it possible to figure out which Path is being clicked on from the user?


I have a solution now where I just have 1 PointCollection per PolyLine. So I am adding one PolyLine/Graphic for each line. I would rather not do this if I can avoid it.

share|improve this question
up vote 2 down vote accepted

If you have one Path per Polyline you can do something like this:

private void map1_MouseClick(object sender, Map.MouseEventArgs e)
            if (map1.Layers["MyGraphicsLayer"] is GraphicsLayer)
                GraphicsLayer glayer = (GraphicsLayer)map1.Layers["MyGraphicsLayer"];
                IEnumerable<Graphic> graphics = glayer.FindGraphicsInHostCoordinates(map1.MapToScreen(e.MapPoint));

                foreach (var graphic in graphics)
                //Do stuff

But if you want to use several Paths per Polyline I guess you have to look at catching the polyline that gets clicked and split that polyline into several polylines and use the GeometryService to do some relation operations on these.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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