POST
|
I know the routing solvers within Network Analyst???namely the Route, Closest Facility, and OD Cost Matrix solvers???are based on the well-known Dijkstra's algorithm for finding shortest paths. Now I want to find the shortest route with A star algorithm,what should I do ? I have created network dataset and develope my programe partly. Please help me! Thanks!
... View more
09-16-2010
05:52 AM
|
0
|
0
|
385
|
POST
|
Hi Alan, Thank you very much for your help! Now I can run my project normally,Thanks again!! Shirly
... View more
09-09-2010
07:14 PM
|
0
|
0
|
484
|
POST
|
Hi Alan, Thank you very much for your help ,I can open my workspace using the absolute path.Now I have anthor problem,below is my code. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using ESRI.ArcGIS.NetworkAnalyst; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.DataSourcesFile; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.DataSourcesGDB; namespace WindowsApplication1 { public partial class Form1 : Form { private INAContext m_NAContext; public Form1() { InitializeComponent(); Initialize(); } private void Initialize() { IFeatureWorkspace featureWorkspace; INetworkDataset networkDataset; // Open GDB and NDS //featureWorkspace = OpenWorkspace(@"C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\data\SanFranciscoNetwork") as IFeatureWorkspace; featureWorkspace = OpenWorkspace(@"E:\wlmq\test.mdb") as IFeatureWorkspace; networkDataset = OpenNetworkDataset(featureWorkspace as IWorkspace, "test_ND"); //networkDataset = OpenNetworkDataset(featureWorkspace as IWorkspace, "Streets_nd"); //Create Layer for Network Dataset and add to ArcMap ILayer layer; INetworkLayer networkLayer; networkLayer = new NetworkLayerClass(); networkLayer.NetworkDataset = networkDataset; layer = networkLayer as ILayer; layer.Name = "Network Dataset"; axMapControl1.AddLayer(layer, 0); } public IWorkspace OpenWorkspace(string strGDBName) { IWorkspaceFactory workspaceFactory; //workspaceFactory = new ShapefileWorkspaceFactory(); workspaceFactory = new AccessWorkspaceFactory(); return workspaceFactory.OpenFromFile(strGDBName, 0); } public INetworkDataset OpenNetworkDataset(IWorkspace workspace, string strNDSName) { IWorkspaceExtensionManager workspaceExtensionManager; IWorkspaceExtension workspaceExtension; IDatasetContainer2 datasetContainer2; // Get Workspace Extension workspaceExtensionManager = workspace as IWorkspaceExtensionManager; int count = workspaceExtensionManager.ExtensionCount; for (int i = 0; i < count; i++) { workspaceExtension = workspaceExtensionManager.get_Extension(i); if (workspaceExtension.Name.Equals("Network Dataset")) { datasetContainer2 = workspaceExtension as IDatasetContainer2; try { return datasetContainer2.get_DatasetByName(esriDatasetType.esriDTNetworkDataset, strNDSName) as INetworkDataset; } catch { } } } return null; } } } Now , I can run my project and no error.But I canâ??t see my networkDataset's geography in axMapControl1.So I try to change my workspace path and my networkDataset to "featureWorkspace = OpenWorkspace(@"C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\data\SanFranciscoNetwork") as IFeatureWorkspace;" and "networkDataset = OpenNetworkDataset(featureWorkspace as IWorkspace, "Streets_nd");",the result display the geography.Why can't my networkDataset diaplay normally? Please tell me why ,Thank you! Shirly
... View more
09-09-2010
05:41 AM
|
0
|
0
|
484
|
POST
|
First, I am sure my encoded file path is correct (the data are examples of Arcgis).Second,the path to the folder contains the shapefile.(i.e.,C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\data\SanFranciscoNetwork\Streets.shp).According to the example of Arcgis--C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Engine\ClosestFacilitySolver,I can run the example,but when I copy the code to my project with the error(can't openworkspace),is that my software's problem? I use AE9.3+VS2005. Thank you very much! shirly
... View more
09-08-2010
01:58 AM
|
0
|
0
|
484
|
POST
|
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using ESRI.ArcGIS.NetworkAnalyst; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.DataSourcesFile; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Geometry; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); Initialize(); } private void Initialize() { IFeatureWorkspace featureWorkspace; // Open GDB and NDS featureWorkspace = OpenWorkspace(Application.StartupPath + @"\..\..\..\..\..\Data\SanFranciscoNetwork") as IFeatureWorkspace; } public IWorkspace OpenWorkspace(string strGDBName) { IWorkspaceFactory workspaceFactory; workspaceFactory = new ShapefileWorkspaceFactory(); return workspaceFactory.OpenFromFile(strGDBName, 0); } } } above is my code,there is error:unexpected COMException,error from HRESULT:0x80040258 when running at line "return workspaceFactory.OpenFromFile(strGDBName, 0);" please help me thank you! shirly
... View more
09-07-2010
01:52 AM
|
0
|
4
|
3328
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|