Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a city roads shp file and would like to identify (select) all the locations where a roads ends (in other words dangles). I am working in ArcView 10.

I do not want to use a topological tool such as ETgeowizards because it can detect and dangles but fixes them automatically with no further options to identify exeptions or even visualize where fixes occured (in my case I will have many exeptions). ArcEditor provides a good interactive environment for identifying which errors are expections - but I am trying to see if I can do this with just ArcView.

The approach I have been experimenting with is to try to identify/select segments in the network that only touch one other segment. I thought the dissolve tool might be an option, but it doesnt look like it has the settings I want in the "unsplit lines" option...

share|improve this question

5 Answers 5

up vote 8 down vote accepted

This can be done using a MapTopology.

Although you cannot create or edit geodatabase topologies with ArcView (only ArcEditor and ArcInfo), you can create and edit map topologies in ArcView.

Create a new Add-in button and copy the code from below.

Add the roads layer to the map and start editing. Open the topology toolbar and create a map topology. Click the button that runs the Test code.

enter image description here

using System;
using System.Collections.Generic;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.EditorExt;

namespace KalkulatorAddin
{
    public class TestButton : ESRI.ArcGIS.Desktop.AddIns.Button
    {
        public TestButton()
        {
        }

        protected override void OnClick()
        {
            try
            {
                Test();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        protected override void OnUpdate()
        {
        }
        public void Test()
        {
            var fSel = ArcMap.Document.FocusMap.get_Layer(0) as IFeatureSelection;
            fSel.Clear();
            var dangleOids = GetDangleOids();
            if (dangleOids.Count > 0)
            {
                var oidarray = dangleOids.ToArray();
                fSel.SelectionSet.AddList(dangleOids.Count, ref oidarray[0]);
            }
            ((IActiveView)ArcMap.Document.FocusMap).Refresh();
        }

        private List<int> GetDangleOids()
        {
            UID topoUiD = new UID();
            topoUiD.Value = "esriEditorExt.TopologyExtension";
            var topoExt = ArcMap.Application.FindExtensionByCLSID(topoUiD) as ITopologyExtension;
            var mapTopology = topoExt.CurrentTopology as IMapTopology;
            if (mapTopology == null)
                throw new Exception("map topology not found");

            //assume just one class in the map topology
            var extent = ((IGeoDataset)mapTopology.get_Class(0)).Extent;
            mapTopology.Cache.Build(extent, false);

            var dangleOids = new List<int>();
            var nodes = mapTopology.Cache.Nodes;
            nodes.Reset();
            ITopologyNode node;
            while ((node = nodes.Next()) != null)
            {
                // sometimes degree is referred to as valence
                if (node.Degree == 1)
                {
                    var parents = node.Parents;
                    parents.Reset();
                    int oid = parents.Next().m_FID;
                    if (!dangleOids.Contains(oid))
                        dangleOids.Add(oid);
                }
            }
            return dangleOids;
        }
    }
}
share|improve this answer
    
Do what @Kirk said - it's much easier :) –  Stephen Lead Dec 9 '11 at 4:16
    
Never really used this MapTopology Interface. I've just had a play with it in VBA and it's great! –  Hornbydd Dec 11 '11 at 19:35
    
Thanks for this example Kirk. I did not mention in my question I was trying to use Python - mostly since I do not have exposure to ArcObjects. However, Hornbydd's Python answer, and comment about its disadvanateges has prompted my to simply delve into ArcObjects. Will be a learning curve, but getting thru the Add-in walk-thru will be a start! –  GIStack Dec 12 '11 at 19:35

You could emulate Arc/Node topology by creating "nodes" from the endpoints of each road. Years ago I wrote an Avenue script which did this - you may be able to recreate this for ArcGIS 10 using VBA or Python.

Once you have a set of nodes, iterate through each node and use the Select By Location function to count the number of arcs which are connected. If there is only one arc connected, it's a dangling segment.

share|improve this answer

You could try the following logic which would be easy to implement in model builder.

  • Extract XY coordinates of FROM end of polyline
  • Concatenate the X & Y into a third string field
  • Do a summary stats on table doing a count on the concatenated field
  • Any values that are 1 must be a "dangling" from end and you could do a relate to pass the selection back
  • Repeat process for TO end of polyline.
share|improve this answer
    
Seems fragile, rounding errors might mess it up. –  blah238 Dec 10 '11 at 20:38
    
I've used this technique before without any problems, it's easy and does not require a user to understand ArcObjects or Python and can easily be implemented in modelbuilder. But I have to admit it was with UK data in meter coordinates so if the data is in decimal degrees then rounding could be a potential problem. –  Hornbydd Dec 11 '11 at 18:51
    
thanks an alternative view - fragile or not. –  GIStack Dec 12 '11 at 19:37

I had the same problem and was looking for an alternative way without ArcObjects programming to solve the problem with ArcView-license and ETgeowizards.

Although you didn't ask for a solution with ETgeowizards you could solve the problem with it, doing the following steps (thanks to @johns, who suggested me this idea):

  1. Create a copy of your street data.
  2. Use ETgeowizards tool "Clean Pseudo Nodes", if your street data has pseudo nodes.
  3. Use ETgeowizards tool "Export Nodes" to export nodes and export only dangling nodes.
  4. Select street parts, that intersects with the dangling nodes with "Select by Location"
  5. Optional: you can sub-select street dangles with a specific length with "Select by Attribute"
  6. Delete selected features.

You can also implement this workflow in Python.

share|improve this answer

Polygonize your layer, I've seen the tool. Buffer the layer with the polygon layer you create. The difference (what is left) should be your dangles. The only thing since I never tried that is does it wind up polygonizing the dangles as well. Just a thought.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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