Select to view content in your preferred language

Create a line starting at a point, and ending a set distance towards a perpendicular line in Model Builder

5832
11
Jump to solution
12-31-2020 04:45 AM
VillageOf_Lake_Placid
Occasional Contributor

I am working with a small electric utility, we are trying to conduct a lighting study with some of our street lights. Currently our system models utility poles and lights as different layers, that are currently coincident. What I would like to do if find a way to create a line of a set distance, the arm length, starting at the pole and directionally towards the center of the road. Then move the light point to the end of the newly created line. Is there a combination of tools or techniques that could be utilized to do this in model builder? 

Attached is what I've done already, and would like to try to find a way to do at a larger scale.

1 Solution

Accepted Solutions
DavidPike
MVP Notable Contributor

Got, it :

Generate points along line, distance is your arm length Generate Points Along Lines (Data Management)—ArcMap | Documentation (arcgis.com)

split line at points Split Line at Point—Help | ArcGIS for Desktop

ensure to set a search tolerance of 0.01 or something, I find if you don't make it explicit, the split messes up.

select by location, Select features by location—ArcGIS Pro | Documentation where the original light points intersect the newly split line features.

export the selection.

select by location again, but where the exported results from select by location intersect the output of the generate points along line tool.

Export the selected points, these will be the new locations you're looking for.

 

light_thing.png

View solution in original post

11 Replies
DavidPike
MVP Notable Contributor

I think your could use the Snap (Editing)—ArcGIS Pro | Documentation snap gp tool within an iterator, something like:

1. Iterate over each point, create a copy of the point and use the snap tool on it to then move the newly created point to a closest road edge.  Theoretically a line drawn between the original point and the snapped point would be perpendicular to the road (not true at vertices etc. though I guess?).

2. Create an actual line from the original point to the newly snapped point.

3. Split the line at the specified fixed distance of your arm length.

4. Delete the rest of the line after the split.

That's very conceptual as it stands, but it might point you in the right direction (possibly).  Interested to see what others come up with 🙂

VillageOf_Lake_Placid
Occasional Contributor

I'll give it a quick try and let you know what I come up with. One of the things is that I have the exact distance the point is supposed to move, essentially always 8 feet. I'm not sure how that might change things.

DavidPike
MVP Notable Contributor

Sure, I initially read it as wanting to generate lines of fixed length from the point which are perpendicular to the road.

You'd initially create all the lines, then use Generate Points Along Lines (Data Management)—ArcMap | Documentation (arcgis.com)

to create new points from a specified distance from the start of the line connecting the original point to the road.

DanPatterson
MVP Esteemed Contributor

Sounds like you want to generate transect lines

Generate Transects Along Lines (Data Management)—ArcGIS Pro | Documentation

If the spacing along the line was equal.
To generate a perpendicular offset at irregular spacing will require some python coding


... sort of retired...
VillageOf_Lake_Placid
Occasional Contributor

Ideally the lines would be generated at a point feature, but created to be perpendicular to the center line of the road.

DavidPike
MVP Notable Contributor

I've done a simple script to generate the lines, just need cut them off at a specified length, but I think that's a start.lights_road.png

0 Kudos
VillageOf_Lake_Placid
Occasional Contributor

Did you use model builder to get this or python? I tested out your recommendation and got something similar, minus the lines.

0 Kudos
DavidPike
MVP Notable Contributor

Python, although it's probably done faster just by running the tools.
Don't judge me by the script, I didn't go for quality. I've put some comments to try and explain the process.

Obviously still need to sort the line length out.

 

import arcpy

arcpy.env.overwriteOutput = True

#####change these to your own hardcoded filepaths!!! ########

#make sure these are all FC's as it uses Object ID
#your roads fc
input_line = r'D:\FGDG.gdb\Road_Lines'
#your lights
input_points = r'D:\FGDG.gdb\Lights'
#hardcoded outputs for interim data, making copies
#as a tool modifies input data later
copied_points1 = r'D:\FGDG.gdb\Light_Copy1'
copied_points2 = r'D:\FGDG.gdb\Light_Copy2'
#the point FC that will be used to create the lines, its made up of the original
#points and those moved to the nearest road centreline.
merged_point_fc = r'D:\FGDG.gdb\Merged_Points'
new_line_fc = r'D:\FGDG.gdb\Lines_to_Roads'
#search distance for snapping
snap_dist = "100 Meters"

#########################################

#make a copy so as to not affect the input data
arcpy.CopyFeatures_management(input_points, copied_points1)

#add an ID field which is equal to the ObjectID of the point
arcpy.AddField_management(copied_points1, "ID_Field", "SHORT")
arcpy.CalculateField_management(copied_points1, "ID_Field", "!ObjectID!", "PYTHON_9.3")

#copy this again
arcpy.CopyFeatures_management(copied_points1, copied_points2) 
 
#input arguments fo Snap_edit tool
snap_env = [[input_line, "EDGE", snap_dist]]
#copied_points2 points then moved to be coincident with road
arcpy.Snap_edit(copied_points2, snap_env)

#create a sort fields and populate it for use later, copied_points1 points all bhave a sort_field value of 1,
#copied_points2 have a sort_field value of 2
arcpy.AddField_management(copied_points1, "Sort_Field", "SHORT")
arcpy.CalculateField_management(copied_points1, "Sort_Field", "1", "PYTHON_9.3")

arcpy.AddField_management(copied_points2, "Sort_Field", "SHORT")
arcpy.CalculateField_management(copied_points2, "Sort_Field", "2", "PYTHON_9.3")

#merge copied_points1 and copied_points2
arcpy.Merge_management([copied_points1, copied_points2], merged_point_fc)

#create the lines.  "id_field" is set to only generate lines for points with a matching ID_Field,
#"Sort_Field" specifies the vertex order of line generation, this means that the start point of the line
#will always be from the original feature.
arcpy.PointsToLine_management(merged_point_fc, new_line_fc, "ID_Field", "Sort_Field")
0 Kudos
DavidPike
MVP Notable Contributor

Got, it :

Generate points along line, distance is your arm length Generate Points Along Lines (Data Management)—ArcMap | Documentation (arcgis.com)

split line at points Split Line at Point—Help | ArcGIS for Desktop

ensure to set a search tolerance of 0.01 or something, I find if you don't make it explicit, the split messes up.

select by location, Select features by location—ArcGIS Pro | Documentation where the original light points intersect the newly split line features.

export the selection.

select by location again, but where the exported results from select by location intersect the output of the generate points along line tool.

Export the selected points, these will be the new locations you're looking for.

 

light_thing.png