1

enter image description here

I have polylines of 80+ bus routes operating in a city. The polylines have attribute values for the number of passengers, number of trips, etc. Many of the polylines overlap at certain areas of the road network. What I want to do is to save the overlapping portions into separate individual shapefiles, that have attribute values that correspond to the sums of those original values. I know how to do this the long way (find the overlaps, cut them and save the separate shapes, manually calculate the attribute values, enter and save the data) but is there a way to do it easier/faster without using scripts?

For example in the image above, the Green Route has 1,000 passengers and travels 20 trips a day while the Orange Route has 500 passengers and 10 trips a day. I'd like to cut out the overlapping area and save it as a separate shapefile with data on 1,500 passengers and 30 trips. This is just a simple example with two routes but I have 80+ in all that overlap in many locations with each other.

  • What GIS software are you using? – BERA Jun 29 '18 at 7:24
  • Oops sorry. I'm using ArcGIS 10 and QGIS 3, but mostly ArcGIS. – DXV Jun 29 '18 at 7:39
  • Dissolve, no multiparts. Spatial join one too many parents who share segment. Summarise result using segment id. – FelixIP Jun 29 '18 at 7:45
  • Thanks FelixIP, but I'm not sure if I completely understood your answer. Please see additional info and image above. So I dissolved two routes first, then spatial joined the outputs together, but I didn't get the desired result. – DXV Jun 29 '18 at 9:44
2

INPUT:

enter image description here

WORKFLOW:

arcpy.Dissolve_management("ROUTES", "..SCRATCH.gdb/SEGMENTS", "SINGLE_PART")
arcpy.SpatialJoin_analysis("SEGMENTS", "ROUTES", "../SCRATCH.gdb/SJ", "JOIN_ONE_TO_MANY",..match_option="SHARE_A_LINE_SEGMENT_WITH")
arcpy.Statistics_analysis("SJ", "../SCRATCH.gdb/STATS", statistics_fields="TRAFFIC SUM", case_field="TARGET_FID")
arcpy.AddJoin_management("SEGMENTS", in_field="OBJECTID", join_table="STATS", join_field="TARGET_FID")

OUTPUT:

enter image description here

Solution will only work if your routes truly share segments and not drawn separately by graduate with degree in GIS.

  • Thanks and sorry for the late comment. I have some questions. 1) I understand that I need to merge all individual polylines first and then dissolve the resulting single polyline - this is step 1 of the workflow. Is this correct? 2) Let's call the dissolved polyline "D". In step 2 Spatial Join, if the "Target Feature" is D, what will be the "Join Feature"? 3) What is the name of the tool that you used on step 3? Is it the tool called "Summary Statistics"? Hope you can follow-up, thanks! – DXV Aug 30 '18 at 7:37
0

I solved this problem with clues from FelixIP's answer above, and great help from the answer I found at How to sum line features. I'm posting this here in the hope that it could also help other non-expert users like myself in the future.

Step 1:

Make sure all overlapping lines are actually overlapping. Using Integrate tool helps.

Step 2:

Use Merge to combine all the individual polylines into one shapefile.

Step 3:

Create a polygon that is large enough to cover the entire polyline.

Step 4:

Use Intersect tool between polygon and polyline with LINE as output type. This will create multiple copies of overlapping line segments and single copies of each non-overlapping line segments. Some of the non-overlapping line segments will be multipart features. This will not be a problem and can be separated into single parts in Step 6.

Step 5:

Use Add Geometry Attributes tool. CENTROID did not work for me but CENTROID_INSIDE did.

  • CAUTION: This will overwrite the shapefile so make sure to backup before running.

Step 6:

Use Dissolve tool. Select INSIDE_X and INSIDE_Y as Dissolve Fields. Select data to combine (no. of passengers, no. of trips) as Statistic Fields and SUM as Statistics Type. Uncheck "Multi_part".

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.