POST
|
Hi there, The code to compute the adjencecy matrix works very good...is there any way to compute the junctions coordinates (X,Y) through this code??? Thanks Philip
... View more
12-24-2010
09:14 PM
|
0
|
0
|
107
|
POST
|
We wanna test a new shortest path algorithm so no optimization is desired at this stage. I'm just using ArcGIS to extract the adjencecy matrix from a real network.... I have a shapeline which represents a road system ...this is built with small polylines ...I additionally have another shapefile (over 2000 points) with represents cities . Cities are not connected by just one polyline..... many small pieces make the connection among cities. So to get the edge_length between two cities (if they are connected) we have to sum all the small pieces (unless we have a way to merge them into one long polyline)... You are right....the real question is how to find out what cities are connected to a given city. My idea is to extend your code to firstly identify cities (intead of junctions) and next try to compute adjancency and distance....somehow I'll have to figure out how to keep tracking of the shape_lengh in the road_system. Any help will be very appreciated. Philip
... View more
09-15-2010
02:27 PM
|
0
|
0
|
519
|
POST
|
Thanks very much Jay.... I was able to run the code.....However, I notice you are using the Network_Junctions as vertices... my network consists of a road layer and cities_layer (points) ..the latter supposedly is my "vertex" layer. Is there a way to use my cities_ layer as vertices rather than the Network_Junctions so that the distance between cities populates the matrix??. (usually cities_layer does not match with your Junction_layer) Regards Philip
... View more
09-14-2010
05:18 PM
|
0
|
0
|
519
|
POST
|
a short update...I was able to fix the "Automation error"...but now I'm gettin a "type mismatch error"... Cheers Philip
... View more
09-14-2010
03:34 PM
|
0
|
0
|
519
|
POST
|
Hi JAy , I've been trying to run the code, but my ArcGIS report an "Automation error"...but there is not specification what error is...no error number, nothing....any idea what problem might be?? THanks Philip Ok. What you want is the connectivity matrix of the network graph and the edge costs. You can generate that by using some VBA that I list below. To use this, add the network dataset to ArcMap. Make sure to change the name of the attribute name (in this case I have it as meters) to the one that is in your data. The run it in the VBA. The immedate window will show the results. You can re-format the debug.print lines (change them to write to a file) as needed. The output will currently look like this: Junction: 1 is adjacent to: 1 junctions. Adjacent Junction: 2 Length 235.7 Junction: 2 is adjacent to: 3 junctions. Adjacent Junction: 1 Length 235.7 Adjacent Junction: 4 Length 470 Adjacent Junction: 6287 Length 287.8 Regards, Jay Sandhu Public Sub List_Adjacent_Junctions() On Error GoTo eh Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pNLayer As INetworkLayer Set pNLayer = pMxDoc.FocusMap.Layer(0) Dim pND As INetworkDataset Set pND = pNLayer.NetworkDataset Dim pNQ As INetworkQuery Set pNQ = pND Dim pEnumNE As IEnumNetworkElement Set pEnumNE = pNQ.Elements(esriNETJunction) Dim pNEdge As INetworkEdge Set pNEdge = pNQ.CreateNetworkElement(esriNETEdge) Dim pNEFromJunc As INetworkJunction Set pNEFromJunc = pNQ.CreateNetworkElement(esriNETJunction) Dim pNEToJunc As INetworkJunction Set pNEToJunc = pNQ.CreateNetworkElement(esriNETJunction) Dim pNE As INetworkElement Set pNE = pEnumNE.Next Dim pNEJunc As INetworkJunction Set pNEJunc = pNE Dim i As Integer Do Until pNE Is Nothing Debug.Print "Junction: " & pNEJunc.EID & " is adjacent to: " & pNEJunc.EdgeCount & " junctions." For i = 0 To pNEJunc.EdgeCount - 1 'For each connected edge... pNEJunc.QueryEdge i, True, pNEdge 'Get that connected edge pNEdge.QueryJunctions pNEFromJunc, pNEToJunc 'Get To junction of current edge Debug.Print " Adjacent Junction: " & pNEToJunc.EID & " Length " & pNEdge.AttributeValueByName("Meters") 'List the adjacency Next Set pNE = pEnumNE.Next Loop Exit Sub eh: MsgBox "Error: " & Err.Description End Sub
... View more
09-14-2010
03:20 PM
|
0
|
0
|
519
|
POST
|
Thanks very much Jay for you valuable help. Regards Philip
... View more
09-14-2010
02:23 PM
|
0
|
0
|
519
|
POST
|
To make it clearer, you have your network with edges and vertices(cities)... each edge (or link connecting two vertices) has a weight associated (in this case distance "d")....I wanna extract the weight of each link from my map and put them in a matrix like (instead of "ones" I need distances):
... View more
09-13-2010
02:32 PM
|
0
|
0
|
519
|
POST
|
Hi there, I have a network dataset which represents roads and a shapefile with cities ....what I wanna do is to generate a cost matrix that contains the distance between two connected cities in the network. For this case the OD_matrix_solver is not desired because it calculates shortest distances between cities.... all I want is the "link_length" between cities..... I've been looking some scripts but most of them just compute euclidean distances between connected points..the question is how I can do the same but using the real shape. I imagine that analogously to OD_matrix_solver...first I'd have to snap locations to my road network and next to generate the matrix. Can anyone give me a little help here???...thanks
... View more
09-12-2010
06:12 PM
|
0
|
12
|
2764
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|