4

I'm trying to programmatically extend hundreds of lines (blue in image) to a single polyline feature (red in image). Sometimes the lines intersect each other, but I'd like the lines to extend, not to other existing lines, but to the polyline feature mentioned before. Even if i select 1 line and the polyline feature, the 1 line is stopped at the other unselected lines. ~ arcpy.ExtendLine_edit(lines, "2000 Meters", "FEATURE")

I can accomplish the process manually in edit mode by selecting the feature, clicking the extend line tool in the advanced editor toolbox, then clicking the line that needs extending. Is there a way to do this part of the selection in python?

enter image description here

  • Is this something you could accomplish using topology rules in a FGDB? – Aaron Jul 12 '13 at 19:25
  • Are the lines you want to extend and the line you EXTEND TO in the same featureclass? – RyanDalton Jul 12 '13 at 20:16
  • 1
    @Aaron, sorry i don't have enough reputation points to post a pic.. the 2km lines are radiating every 10m from a shoreline at a specific angle - some don't reach the ~opposite shore for a good 5km, so.. i'm not sure if setting a property in the fgdb would help here? the lines are in an fgdb. – mwil Jul 12 '13 at 20:42
  • @RyanDalton no for the manual edit, yes for the arcpy.ExtendLine_edit() test where the lines stopped when they intersected each other instead of stopping when they reached the opposite shore. it took, no joke, a couple of months to process via python (arcgis 10.1) to get these lines then clip them to a complicated Chesapeake Bay shoreline, so i'm loathe redo the line generation at a longer length and do the subsequent ENDLESS clip. – mwil Jul 12 '13 at 20:55
  • maybe i could create an in memory fc of each line with the shoreline and extend each line seperately... ugh! there's got to be a better way... right? @Aaron@Ryan thanks for your suggestions! @Aaron, if you have any suggestions re fgdb i'd try 'em. – mwil Jul 12 '13 at 20:56
2

In case this helps anyone else:

I did just ended up doing the following:

  1. selecting lines over a specific length,
  2. copied those to an in_memory shapefile,
  3. used the start_x, start_y coordinates to inform arcpy.BearingDistanceToLine_management() to generate new, ridiculously long lines, and
  4. clipped the lines by the shoreline polygon.
  5. multipart to single part, and got the new segments which had start points matching the original.

It didn't take as long as the first clip of every line radiating from the shore - but it would've been great to have an extend line option since it's manually possible!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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