Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ArcGIS中环形路网的提取_Arcgis - Fatal编程技术网

ArcGIS中环形路网的提取

ArcGIS中环形路网的提取,arcgis,Arcgis,我有一个带有悬挂节点和环形道路的道路网络。我已经移除了悬空的道路,现在我还想移除环形道路。谁能告诉我我能做什么。提前感谢(:1)在道路网络中查找环路: 对于形成3/4环路的道路,使用弯曲度公式(线端点之间的距离/长度)。Python公式是: !Shp_lngth! / math.pow(math.pow( !X_Start! - !X_End! , 2 ) + math.pow( !Y_Start! - !Y_End!, 2 ), 0.5) > 2 对于仅位于道路末端的环路(如死胡同灯泡

我有一个带有悬挂节点和环形道路的道路网络。我已经移除了悬空的道路,现在我还想移除环形道路。谁能告诉我我能做什么。提前感谢(:

1)在道路网络中查找环路: 对于形成3/4环路的道路,使用弯曲度公式(线端点之间的距离/长度)。Python公式是:

!Shp_lngth! / math.pow(math.pow( !X_Start! - !X_End! , 2 ) + math.pow( !Y_Start! - !Y_End!, 2 ), 0.5) > 2
对于仅位于道路末端的环路(如死胡同灯泡),请使用“创建路线”工具,并查找具有4或更高公共性值的道路

2) 查找道路网络中的悬挂节点: 使用此代码

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;
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用ESRI.ArcGIS.Geodatabase;
使用ESRI.ArcGIS.Carto;
使用System.Windows.Forms;
使用ESRI.ArcGIS.esriSystem;
使用ESRI.ArcGIS.EditorExt;
名称空间KalkulatorAddin
{
公共类测试按钮:ESRI.ArcGIS.Desktop.AddIns.Button
{
公共测试按钮()
{
}
受保护的覆盖void OnClick()
{
尝试
{
Test();
}
捕获(例外情况除外)
{
MessageBox.Show(例如Message);
}
}
受保护的覆盖void OnUpdate()
{
}
公开无效测试()
{
var fSel=ArcMap.Document.FocusMap.get_层(0)作为IFeatureSelection;
fSel.Clear();
var dangleOids=GetDangleOids();
如果(悬挂曲面数>0)
{
变量oidarray=dangleOids.ToArray();
fSel.SelectionSet.AddList(dangleOids.Count,ref-oidarray[0]);
}
((IActiveView)ArcMap.Document.FocusMap.Refresh();
}
私有列表GetDangleOids()
{
UID topoUiD=新UID();
topoUiD.Value=“esriEditorExt.TopologyExtension”;
var topoExt=ArcMap.Application.FindExtensionByCLSID(topoUiD)作为ITopologyExtension;
var mapTopology=topoExt.CurrentTopology作为IMapTopology;
if(mapTopology==null)
抛出新异常(“未找到映射拓扑”);
//假设映射拓扑中只有一个类
变量范围=((IGeoDataset)mapTopology.get_类(0)).extent;
mapTopology.Cache.Build(区段,false);
var dangleOids=新列表();
var nodes=mapTopology.Cache.nodes;
nodes.Reset();
雌蕊节点;
while((node=nodes.Next())!=null)
{
//有时度被称为价
if(node.Degree==1)
{
var parents=node.parents;
父母。重置();
int oid=parents.Next().m_FID;
如果(!dangleOids.Contains(oid))
添加(oid);
}
}
返回悬挂体;
}
}
}