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

Does anyone have a bit of code to plot a multiline? I just want to add some IPoints to a collection and display in a particular color and width, but I can't find a good way to do this.

Right now I'm using this after a dynamic draw event: dynamicDisplay.DrawMultipleLines(pointcollection);
But there's no clear place to set the graphic attributes, and it plots incorrectly.

share|improve this question
Are you setting the projection on each IPoint or the IPointCollection? That may account for the incorrect plot. – BlinkyBill Aug 30 '10 at 22:54
@eldac PointCollection doesn't appear to have a project method, as far as I can tell the only way to set projections is on a point by point basis. – patrick Aug 31 '10 at 13:49
If your IPointCollection is a Multipoint instance, you can project using its IGeometry.Project method. You do not need to project if your point coordinates are in the map's coordinate system. Anyway, just to clear this up a bit, is there a reason why you are using dynamic display instead of classic IDisplay? – Petr Krebs Aug 31 '10 at 16:57
@petr k. display.drawPolyLine throws a COM error. Also I don't really know the difference between the two so I am just trying different things. – patrick Aug 31 '10 at 17:10
up vote 2 down vote accepted

You can use a GraphicsLayer to do this, create a line element and add to the GraphicsContainer. Snippet: Add Graphic to Map Snippet

share|improve this answer

Here's what I did

I inherited BaseDynamicLayer and called AddLayer from my axMapControl. Then I overrode DrawDynamicLayer and did a iDynamicDisplay.DrawPolyline

But the trick was I used a IPointCollection4 obj and NOT a IPointCollection5 obj as an argument to the DrawPolyLine

IPointCollection4 myPolyLine = new PolylineClass(); //IPointCollection5 DID NOT WORK FOR ME
//add some points
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.