Tuesday 16 October 2018

arcgis desktop - Counting road intersections and blocks


I have a shp file that consists of the road system of Mexico City. I would like to count the number of road intersections (crossings) and blocks (which I would define as a segment starting from one intersection and ending in another). This within a buffer of a certain size: a circle centered in a polygon within another shp file.


I am mainly using ArcGIS but am quite familiar with R, Python and QGIS if the solution is simpler on any of those. I realize their are a few similar questions around here but havent been able to use any of the information provided there.



Answer



Considerations


First thing to consider, you might remove freeways and ramps from your road system before you start, depending on your interpretation of a block or intersection.


First problem is knowing the state of your road system. If road centerlines are split at each intersection and only at intersections, then we proceed with Features Vertices to Points. This would mean that roads do not break at underpasses and overpasses. Under this method, you use your original road system for your road segments.


If road centerlines are not split at all (e.g. routes) or if they split at places other than intersections, then you will have to run Unsplit Line on the entire system first and proceed with the Intersect method. This method will, unfortunately, break the roads at overpasses and underpasses. You could manually fix these if you have knowledge of where they are.



Feature Vertices to Points Method


Run Feature Vertices to Points(Data Management - Features). Input is your road network, Point Type is Both_Ends. This will create a point layer corresponding to the endpoints of each road segment. An intersection will have one point for each road that ends at that intersection.


Using your output from that tool, run Collect Events (Spatial Statistics Tools - Utilities). This will collect those multiple endpoints at an intersection together and count out the number of endpoints at each intersection


Take your output from Collect Events and delete all events with an ICOUNT < 2. These points are dead ends. This will leave you with an intersections point layer now (where ICOUNT is the number of road segments that intersect).


Intersect Method


Run Intersect (Analysis - Overlay) with only your road system as your input features. Set the output type to POINT.
This will give you your intersections and only your intersections (no dead ends).
To ensure that your road system is properly split at your intersections, also run Split Line at Point (Data Management - Features) on your road system. Use the output from this tool as your road segments.


Removing Dead End Segments


Based on your definition, a road segment that dead ends is not a block. If you do want to count road segments that dead end as blocks, you can skip this section and just use your road segments as your blocks.



Run a Spatial Join (Analysis - Overlay). Target features are your road segments. Join Features are your intersections. Join Operation is JOIN_ONE_TO_ONE with Keep All Target Features unchecked. Your output is the road segments, where join count is the number of intersections for that segment. You should only see values of 1 or 2 in the joint count.


Delete all road segments in the Spatial Join output with joint count of 1. These are dead end road segments. Any segment with a count greater than 2 needs to be check; you should not have these. All segments with join counts of exactly 2 are blocks by the definition you provided.


Selecting Blocks or Intersections


Now you have one layer with just your blocks (if you included dead end blocks, you can use your original road system) and another layer with just your intersection.
To find out how many blocks are in your buffer area, use Select Layer by Location (Data Management - Layers and Table Views) or the Select By Location... tool using your blocks layer as your target and your buffer as your selecting features or source.
To find out how many intersections are in your buffer area, use Select Layer by Location (Data Management - Layers and Table Views) or the Select By Location... tool again, using your intersections layer as your target and your buffer as your selecting features or source.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...