Get points along a polyline at defined distance

2996
4
06-09-2014 08:27 AM
AndreaMatoffi
New Contributor
Hello,

i need to store into my array the points along the polyline each defined distance.
Example:
The Polyline lenght is 50m, i set interval to 5m. I have to store in the array all the points along the polyline each 5meter.(points on 0m-5m-10m-15m....).

I'm using c#.
Any function to get theese points?

Thanks,
Andrea
0 Kudos
4 Replies
RichardFairhurst
MVP Honored Contributor
Hello,

i need to store into my array the points along the polyline each defined distance.
Example:
The Polyline lenght is 50m, i set interval to 5m. I have to store in the array all the points along the polyline each 5meter.(points on 0m-5m-10m-15m....).


Any function to get theese points?

Thanks,
Andrea


If you convert your lines to Linear Referenced Routes using the Create Routes tool you could create an event table with those distances along the line and find the positions of each using the Make Route Event Layer.  You would need to use the Error Field option to detect when a measure is not on the line.  Creating a base event table is easy in a spreadsheet and just needs a RouteID field and a double measure field with enough rows with 5m intervals to cover you longest line.

You can call all of the tools using the .Net geoprocessing interface to call the tools.  Or creeate the routes in Desktop before coding your solution.
0 Kudos
ModyBuchbinder
Regular Contributor II
Hi

I would try ICurve.QueryPoint  this method should do it...

Have fun
Mody
0 Kudos
AndreaMatoffi
New Contributor
Edit:
It works, thanks a lot mody.

-----------------------------

Another question:

Is it possible to store 2 polylines (one selected from arcmap and one created in c#) into one shape file?
If yes, how can i do it? Thanks
0 Kudos
ModyBuchbinder
Regular Contributor II
Hi

Polyline is just a collection of geometries (path's for polyline) that can be accessed by IGeometryCollection.
You can create a new polyline and use the IGeometryCollection.AddGeometry to add the path's from both original polylines.
The result polyline will be multipart.

Have fun
Mody
0 Kudos