Calculating angles using ArcGIS Desktop 10.2

15153
32
Jump to solution
01-21-2016 11:17 AM
BrianVann
New Contributor II

I need to find angles of streets where they intersect with roadways covering the entire state. Does anyone have a method and/or tools in mind?

0 Kudos
1 Solution

Accepted Solutions
WesMiller
Regular Contributor III

Attached is a model that should accomplish what you are trying to do.If you'll add your streets layer and leave the defaults it should produce a point file at each intersection that has an angle between 5 and 40. I made these parameters so they could be adjusted, the other distance field is how far back from the intersection do you want to check the angle, 50 was used you may want smaller. The model will need an Advanced license to run.

View solution in original post

32 Replies
WesMiller
Regular Contributor III

if you have an Advanced License you could use the Near—Help | ArcGIS for Desktop

BrianVann
New Contributor II

Thanks for the help Wes!

It looks as though this tool returns angle values in relation to North, South, East, or West. I am looking for a method that returns an angle where 2 lines intersect. In addition, I have a least a few hundreds of thousands of intersecting lines to measure those angles... We are trying to find all the intersecting roadways in the state that are at an angle of less than 40 degrees, where they intersect, and run crash rates and analyses. Do you still think this tool will do the job of measuring those angles?

Thanks again for the prompt response!

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

You might want want to move this to Geoprocessing GeoNet Community Structure  this space is for help on GeoNet and how to use it.

0 Kudos
WesMiller
Regular Contributor III

Attached is a model that should accomplish what you are trying to do.If you'll add your streets layer and leave the defaults it should produce a point file at each intersection that has an angle between 5 and 40. I made these parameters so they could be adjusted, the other distance field is how far back from the intersection do you want to check the angle, 50 was used you may want smaller. The model will need an Advanced license to run.

BrianVann
New Contributor II

Wes,

Thanks!

I ran the model and it failed with this error:

Assembling Features...
Succeeded at Mon Jan 25 11:06:26 2016 (Elapsed Time: 2 minutes 4 seconds)
Executing (Generate Near Table): GenerateNearTable in_memory\roadsIntersect in_memory\Roads_Intersect_Buffer_Inter in_memory\nearTable "51 Feet" NO_LOCATION ANGLE ALL 0 PLANAR
Start Time: Mon Jan 25 11:06:27 2016
Determining data processing extents...
Building a neighborhood index from the Near Features...
Generating Near Table...
Found 346 feature(s) within 51.000000
Succeeded at Mon Jan 25 11:06:27 2016 (Elapsed Time: 0.56 seconds)
Executing (findLessThanAngle): findLessThanAngle 50 5 in_memory\roadsIntersect in_memory\nearTable
Start Time: Mon Jan 25 11:06:27 2016
Running script findLessThanAngle...
Failed script findLessThanAngle...

Traceback (most recent call last):
  File "Y:\GISData\Tools\FindAngletoolbox\findAngle.tbx#findLessThanAngle.py", line 37, in <module>
NameError: name 'each' is not defined

Failed to execute (findLessThanAngle).
Failed at Mon Jan 25 11:06:28 2016 (Elapsed Time: 0.23 seconds)

I deleted the "each" out of the python code, ran it, but it only gave me 22 intersecting roadways with angles of < than 50 degrees out of 2299 total...I wasn't sure if it was my python code editing that gave me the short list.

I  know very little about python. It is in my toolbox of things to do, no pun intended.

Other than that, it does look promising!

Thanks again for your help!

0 Kudos
WesMiller
Regular Contributor III

Would you be willing to share a portion of your data? 22 is far less than i expected for a state wide search. I'll check the code against your data. I tested this code against county data and returned over 200.

0 Kudos
BrianVann
New Contributor II

Wes,

Sorry for the delayed response. Been kind of busy.

Yes, I have attached a county with a roadway layer here. I have tried running the model several more times and now I cannot get any results at all to show in the table of contents. Did I mess something up?

I have also attached the model again here to verify whether or not I have corrupted it... I even tried removing the original model and reinstalling it into the "Toolbox" in ArcMap...

Thanks,

Brian

0 Kudos
BrianVann
New Contributor II

The last reply didn't have an "attach" tool located on it...

Attached is a county dataset. As I said earlier, the model will not offer any results on this county either, although it does run and complete.

I have also attached here again the "findAngle" tool to check if I have corrupted it...

Thanks again for your help!

Brian

0 Kudos
BrianVann
New Contributor II

Wes,

I edited the model again using file geodatabases instead of the "in_memory" modules and YES, the model completes and stores the intersection locations that have the upper and lower limit angles.

Awesome!  I HAVE to learn Python!!

Thanks!!

0 Kudos