Select to view content in your preferred language

How do I create points along a polyline based on distance?

11665
19
10-01-2014 02:21 PM
JoshWhite
Honored Contributor

Is there a tool or script out there than can be used to create points along a polyline based on a distance in table?

Josh White, AICP
Principal Planner

City of Arkansas City
Tags (1)
19 Replies
DanPatterson_Retired
MVP Emeritus

What is the table structure?  If they were easily spaced, then a simple densification would work, but obviously this is not the case

You could also look at this thread   and the help file on discussion on linear referencing

JoshWhite
Honored Contributor

Thanks for your reply.  I will get more specific.  I'm working with Sewer CCTV and Esri had created a script to use this data but it was having a lot of issues, mostly because it was the first release.  They have reworked some things and I haven't got a chance to get back to it yet but hopefully that helps.  If not, I may turn to linear referencing.  However, I worry that when I rebuild the network that the routes would also be updated, perhaps I am wrong about how this works.

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
RichardFairhurst
MVP Honored Contributor

Normally, the Routes don't rebuild unless you make them rebuild.  As a result, holding positions through events can be a challenge.  But you can convert events to true points that are not relative to the route and then they will hold their position even if the route changes or you can calculate before and after XY coordinate values into the events and compare then to detect changes and make updates as necessary.

The Roads and Highways Extension does maintain updates as edits are made to Centerlines and registered event tables are synchronized with the edits according to the rules you define.  But without that extension the event tables and routes can get out of sync.

JoshWhite
Honored Contributor

That was my main fear of doing that.  I actually checked with my account manager on that extension and wow...too pricey for my blood.

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
TedKowal
Honored Contributor

What Richard says is true, however, I do not find this a challenging thing to overcome (the price of the Highways Extension is).  A general rule, the events will change location if you added length to the beginning of the route or some sort of alignment has occurred.  When these conditions occur, I simply:

  1. Export the events to a feature class and calculate their XY coordinates
  2. Update my LRS
  3. Run a tool I developed in VB.NET  ArcObjects
    1. This tool snaps the Exported events feature class back to the new LRS. (This can be accomplished all through a manual process)
      1. Calculates the new measure
      2. Calculates the new offset (if any)
    2. Export the data back to a table with the new measures/offset (This will be the new event table).  In our shop most of our attribute data resides in databases outside of ArcGis.

This is not really a hard process.... Our LRS rarely changes so this is not something I have to do a lot.

DarrenWiens2
MVP Honored Contributor

Back to the original question, you can fairly easily place a point along a line at a feature-specific distance using arcpy geometry objects - specifically, the positionAlongLine method in the Polyline object.

positionAlongLine (value, {use_percentage})

Returns a point on a line at a specified distance from the beginning of the line.

JoshWhite
Honored Contributor

what about a specific distance rather than a percentage?

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
RichardFairhurst
MVP Honored Contributor

Since I use Linear Referencing I have no use for this function.  It performs approximately 50 times slower than an LR event layer from a table based on other geometry operations I have tried.  Your welcome to pursue it, but unless you can get 120K points to draw in under 30 seconds, I have you beat with my LR event layer.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Josh, positionAlongLine defaults to using an absolute distance. If you want to use a percentage, you would change the optional second parameter to True (I think).

Richard, this is clearly just one method, and for me using Python geometry objects is more flexible than finding the fastest pre-made tool. IMHO, it also directly answers the question, "how do I create points along a polyline based on distance," better than "read the help on Linear Referencing".

0 Kudos