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.

5 Answers 5



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.


There are a few ways to do this. For the intersections you can use a tool in QGIS (Arc I am sure too) called Line Intersections (Vectors - Analysis Tools). As for the blocks, what I have done for that is to have a polygon of the AOI which covers the entire area. Then I use the roads to cut that polygon into polygon segments. This will give you blocks of polygons that have the roads as the boundaries. To do this, I have used XTools or ETGeoWizards in ArcMap.

  • I think by blocks, the OP means just a street segment, not the actual polygon enclosed by multiple street segments. +1 though, and even if not exactly the what the OP wanted this is good to know as well.
    – Andy W
    Commented Mar 20, 2013 at 16:17
  • You reminded me that the Intersect tool in ArcGIS with line input and point output can simplify the problem -if- certain assumptions are made. Thanks! Commented Mar 20, 2013 at 16:19

Try running the Intersect tool in ArcGIS with a single input (the roads) and the output type as POINT; this should give you the number of intersections. As far as the number of blocks, this is just a count of the line segments, if you need to "break" each segment at an intersection look into the Planarize lines feature on the topology toolbar.


As a footnote to this and a shameless author's plug, the free sDNA (spatial Design Network Analysis) plugin for ArcGIS can do this, among other things that may be of interest to you.

You would first need to ensure your network was correctly noded (i.e. all lines breaking where there are junctions; Topology->Planarize can do that).

  • I'll try it out.
    – JEquihua
    Commented May 1, 2013 at 15:03
  • Great :) I should point out that what you call "blocks", sdna calls "links". Hope it helps. Commented May 2, 2013 at 11:02

You can use network tools. It can create the junctions, and convert the junctions into point shpfile. After getting the point shpfile, all you have to do is knowing count of points. As for the blocks, just count the line segments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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