POST
|
Hello! First of all I would like to mention that a I am an amateur ArcObjects user, that's why my code does not seem professional. I'm trying to perform a network Analysis to a given network without the Network Analyst (I am not an owner of a license). After having created inside my personal geodatabase the geometric network (through the ArcCatalog Wizard) of a given polyline network and assigned weights to the links, I am trying to "traverse" it by using the ForwardStar method. Here's the code. Private Sub GetNodes() Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pAWFactory As IWorkspaceFactory Set pAWFactory = New AccessWorkspaceFactory Dim pFeatWorkspace As IFeatureWorkspace Set pFeatWorkspace = pAWFactory.OpenFromFile("FilePath", 0) 'I Give the FilePath manually Dim pFeatDataSet As IFeatureDataset Set pFeatDataSet = pFeatWorkspace.OpenFeatureDataset("FeatDataset") Dim pNetCollection As INetworkCollection Set pNetCollection = pFeatDataSet Dim pGeomNet As IGeometricNetwork Set pGeomNet = pNetCollection.GeometricNetworkByName("FeatDataset_Net") Dim pNet As INetwork Set pNet = pGeomNet.Network Dim pEdgeWeight As INetWeight Set pEdgeWeight = pNetSchema.WeightByName("LENGTH") 'The field from where the weights should be extracted Dim pForStar As IForwardStar Set pForStar = pGeomNet.Network.CreateForwardStar(False, pEdgeWeight, pEdgeWeight, pEdgeWeight, Nothing) Dim lCnt As Long Dim AdjW As Double Dim AdjEdgeEID As Long Dim li As Long li = 2 'Just a number for test pForStar.FindAdjacent 0, li, lCnt pForStar.QueryAdjacentEdge 0, AdjEdgeEID, False, AdjW MsgBox "Edge = " & AdjEdgeEID & " " & "Weight = " & AdjW End Sub Although the AdjEdgeEID returns a logical number the AdjW keeps returning 0 Could anyone provide me with some help? Thank you in advance!
... View more
05-14-2012
02:45 PM
|
0
|
0
|
524
|
POST
|
The algorithm for finding the shortest path is up and running. My only problem is how to access the "Logical network" in order to get the ID's of the nodes at the edges of each link.
... View more
05-11-2012
06:36 AM
|
0
|
0
|
345
|
POST
|
Hello My project involves finding the shortest path within a polyline shapefile, without using the network analyst (not an owner of a licence for the specific product). Eventually i need the ID's of the nodes(edges) that "create" this network although i cannot find where this information is stored. After some research I believe the answer lays somewhere the INetwork interface but my skills at ArcObjects with VBA are still novice. I'd be glad if someone could help me further.
... View more
05-10-2012
04:30 PM
|
0
|
3
|
1383
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|