Repeat label on long line


When working with long lines like contour lines, labeling once might not be enough:

Zooming in:

Most labels of these contour lines are outside the view.

We should add a repeat option with a distance in map units to repeat the label on the contour line instead of only the current options:


Paul Meems
May 5, 2019, 11:56 AM

Hi ,

If you think we can extend the GenerateLabels method for this, that would be great.
But it needs to be backwards-compatible. I think this can be solved by adding an optional parameter for the distance.
In the past I remember that optional parameters didn't work with COM. That's why we have so many methods that look similar.
If you are sure this is no problem you can go ahead and implement it.

Jerry Faust
May 4, 2019, 5:57 PM

Thanks, Paul. I didn't make the connection before that this applied to individual polylines that were very long.

Could this be added as a label drawing attribute? perhaps specifying a maximum distance and if the line is longer than that distance, we try to space them evenly along the line at that distance? I'm thinking this could be handled within the GenerateLabels method.

Does this sound appropriate?

Paul Meems
May 4, 2019, 9:24 AM

I created a small unit test to show how this could be implemented:

The 'trick' is to use the new shp.InterpolatePoint method.

What do you think? Would this be easy to implement in MapWinGIS?
I assume we need a new function and my example needs to be extended to handle only polylines, multiple projections, etc.


Jerry Faust


Paul Meems



Epic Link


Affects versions

Fix versions