|
POST
|
So, you need to set the active category on the active analysis shown in the NAWindow. To start, here is a bit of code to get the EngineNetworkAnalystEnvironment: public static IEngineNetworkAnalystEnvironment GetTheEngineNetworkAnalystEnvironment() { // The network analyst environment is a singleton, and must be accessed using the System.Activator System.Type t = System.Type.GetTypeFromProgID("esriControls.EngineNetworkAnalystEnvironment"); var naEnv = System.Activator.CreateInstance(t) as IEngineNetworkAnalystEnvironment; return naEnv; } Use that (along with a NALayer) to set your active analysis layer: // Set the active Analysis layer IEngineNAWindow naWindow = naEnv.NAWindow; if (naWindow.ActiveAnalysis != naLayer) naWindow.ActiveAnalysis = naLayer; At that point, you should be able to set the active category by clicking on it in the NAWindow during application runtime. Does this work for you? You can set the category programmatically, but I'm not sure it is necessary in your case. Once the naWindow is open, has an active analysis in it, and has an active category selected, the add location tool should work as you expect it to.
... View more
11-17-2011
10:02 AM
|
0
|
0
|
1806
|
|
POST
|
Nice detective work. That is where I was going to send you. The create locations tool should work appropriately depending on the type of class that is active. For stops and point barriers, it will place points. For line barriers, it will draw polylines. For polygon barriers, it will draw polygons.
... View more
11-17-2011
09:32 AM
|
0
|
0
|
1806
|
|
POST
|
Hello, Renee! To be clear, are you interested in loading barriers programmatically from already existing polygon/polyline features? Or are you attempting to have users draw them manually in a stand-alone application?
... View more
11-17-2011
06:34 AM
|
0
|
0
|
1806
|
|
POST
|
Just to further the help that Jay has already given... There are a couple of resources to help you code a custom solver. Using .NET, there is some code that uses our API to create a breadth-first solver algorithm here. There is also a custom solver written in C++ that helps determine connectivity within a network here. There is always the chance, too, that we provide the functionality that you are looking for, without the use of a custom solver. Are you writing one for the experience? Or are there specific capabilities that we don't provide yet?
... View more
11-09-2011
05:38 AM
|
0
|
0
|
1834
|
|
POST
|
Were you looking at implementing your own custom directions agent, or utilizing the ones that work with the existing Route solver?
... View more
11-07-2011
05:53 AM
|
0
|
0
|
359
|
|
POST
|
The .NET SDK help for Network Analyst begins by assisting you in determining your goals and helping you find the code samples and help documentation to accomplish them. Start by looking here: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Programming_with_Network_Analyst/000100000462000000/ When you install the .NET SDK, you will get a set of samples and data that you can work with. You could also download the samples from the SDK help site online. Some of the samples that could be of use to you include: Programmatically using the Route solver A Network Analyst Engine application that can behave similar to ArcMap A simple example of custom solver code Setting up a UI for a single solver You asked about which inputs are required. In all three of the code samples above, a network dataset is necessary. Aside from that, you'll need to know which type of analysis you are doing (Route, Closest Facility, etc), and have a set of input locations upon which to route. Hopefully, all of this helped. If you can be more specific about your ultimate goal, I can give you some more specific instructions. Are you looking to utilize the existing Route solver in a stand-alone application? Are you using a custom solver in a stand-alone application? Do you want to publish routing services for use on-line? Are you looking for help in setting up the user interface, or in setting up the solver itself? Are you utilizing geoprocessing? In any case, I highly recommend going through the Network Analyst tutorial. It will give you a firm basis in the capabilities and usage patterns of Network Analyst.
... View more
11-07-2011
05:38 AM
|
0
|
0
|
829
|
|
POST
|
Unfortunately, there is no easy way to get a traversal result via python at 10.0. We addressed the issue at 10.1. To do it at 10.0, your best bet would be to create a custom GP tool. That way, you could reference it from within the same process as you execute your python script. There is documentation about custom GP tools in the SDK. If you are comfortable in geoprocessing and in .NET ArcObjects development, you will create a GP tool using the relevant parts from the traversal result add-in .NET code.
... View more
09-28-2011
10:00 AM
|
0
|
0
|
537
|
|
POST
|
This post is a cross-post with the Network Analyst forum. Please continue the discussion there, if Network Analyst is indeed your tool of choice for this problem. http://forums.arcgis.com/threads/40364-Road-graph-correctness-control Thanks
... View more
09-28-2011
09:37 AM
|
0
|
0
|
319
|
|
POST
|
This post is a cross-post with the Transportation forum. I added some suggestions there as well. http://forums.arcgis.com/threads/40364-Road-graph-correctness-control
... View more
09-28-2011
09:36 AM
|
0
|
0
|
610
|
|
POST
|
Hello, Have you used Network Analyst before? If not, see the desktop help about how it all works. Do you have your data in a network dataset? If not, go and create a network dataset out of your street data. After that, there are a few ways to verify connectivity using Network Analyst: You could use the Network Identify tool on the Network Analyst toolbar. With that tool selected, you click on a network element, and you can see which elements are connected to it. This is another manually way and would be pretty tedious. You could generate lines with the Service Area solver to make sure that there is connectivity in the network draft. This would show you where there were disconnects in the graph, but it would be difficult to determine exactly what connected to what else. Lastly, for full automation of this, you could programmatically determine exactly which elements are connected to which other elements. There are a couple of ways to accomplish this as well. This simplest is probably by starting with the INetworkJunction interface. 1. In ArcCatalog, set up your node IDs as descriptor attributes on your network dataset. 2. In code, get a reference to your network dataset, then cast to INetworkQuery. 3. INetworkQuery::CreateNetworkElement to cocreate a junction. 4. INetworkQuery::QueryJunction to populate your newly create junction. 5. Use INetworkJunction::EdgeCount and INetworkJunction::QueryEdge to iterate over the edges connected to that junction. 6. Use INetworkElement::AttributeValueByName to get the ID values for your network edge. 7. Get the from and to junctions use INetworkEdge::QueryJunctions. 8. Go to step 5, and in the meantime, verify that the IDs of the adjacent edges are the ones you expect them to be. Hopefully, this wasn't too confusing.
... View more
09-28-2011
09:24 AM
|
0
|
0
|
319
|
|
POST
|
One more thing... If you are looking for a programmatic way to load data, please see How to load data into a network analysis problem. It has code in .NET, but the concepts are the same if you are using Java or C++.
... View more
09-28-2011
08:43 AM
|
0
|
0
|
829
|
|
POST
|
Hello, Sébastien. When in ArcMap, do you see your custom solver in the drop-down for creating new layers (click on "Network Analyst" on the network analyst toolbar)? If so, when you make a new layer, do you see it appear in the NA Window (Click the network analyst window button on the toolbar to make that appear)? If both of those are the case, you should be able to right click on your input class in the NA window and choose Load Locations. Then, be sure to load your location by geometry (select Use Geometry in the Location Position box). If you instead chose Use Network Location Fields, then you will get the network locations for the network dataset associated with the solver you loaded from. Also, if you already loaded by location field, you can right click on your input class in the NA Window and choose Recalculate Locations. That will recalculate your NALocation fields using the geometry of the network dataset associated with your custom solver layer. Did this help? Out of curiosity, what does your custom solver do? Thanks
... View more
09-28-2011
08:38 AM
|
0
|
0
|
829
|
|
POST
|
Hello, Jill! You can use the traversal result for the route to generate all of the traversed edges and junctions. The feature classes created here can help you find out where along the route you passed toll booths. If you are on 10.1 beta, you can use the GP tool, Copy Traversed Source Features. For 10.0, install the Network Analyst Traversal Result Add-In. After you solve your route, run the GP tool, or click on the Add-in to add the traversal results to your map. You can determine the toll booths you passed by looking at the junction and edge feature classes that are created. For each toll booth, represented by an additive cost point barrier, you will find 2 midspan junctions and a zero-dimensional line (a line where the from and the to position are identical). In order to support measures on lines, the added cost of the point barrier is applied in the traversal result to the zero-dimensional line. You should see a line with the same from and to, along with a value in the Attr_<name of your cost attribute> field that contains the cost that was added by the toll booth. For example, say I have an additive barrier of cost $10 at the 0.5 position of edge that costs 2 minutes to traverse. I am solving on TravelTime, but accumulating toll costs. I would see in the Edges table (along with many other fields): FromPosition - ToPosition - Attr_TravelTime - Attr_TollFees 0 - 0.5 - 1 - 0 0.5 - 0.5 - 0 - 10 0.5 - 1 - 1 - 0 You can see 3 edges. The first and last entry are the cost of traveling from 0 to 0.5 and 0.5 to 1 along the edge. The second entry is the $10 fee for the toll booth. Hopefully, this helps.
... View more
09-22-2011
08:11 AM
|
0
|
0
|
1063
|
|
POST
|
I didn't try running your code, but I think I see what your problem is. In the method IEnumVertexExample, you take a NALayer (cast as ILayer) and try to cast it as a IPointCollection: public void IEnumVertexExample(ILayer nlyr)//(add nalayer(route) here) { IPointCollection pointCollection = nlyr as IPointCollection; Here is a helpful hint in using the resource center to work with ArcObjects: You can go to the link for an interface and see which CoClasses implement that interface. If you go to IPointCollection, and scroll down to "CoClasses that implement IPointCollection", you won't see NALayer as one of those options. You need one of the classes that is listed there. In your case, you need a Polyline. For the most part, a layer is just a reference to some data, for the purposes of displaying it in ArcMap or elsewhere. Network Analyst Layers (NALayer), instead of referencing data in a geodatabase or shapefile, references some in-memory feature classes. More specifically, the NALayer is a composite layer that holds sublayers that reference in-memory feature classes. I know, it is a bit confusing. For your scenario, you need to take your INALayer, get its Context, via INALayer.Context. Then you use the Context to get to the subclass that interests you, "Routes". That subclass holds your output route geometry. Then you use a feature cursor to iterate over the rows of the class. You should only have one row in your Routes class. Get that row and get the polyline from it. That polyline is your output route geometry. INAContext naContext = naLayer.Context; IFeatureClass routesClass = naContext.NAClasses.get_ItemByName("Routes") as IFeatureClass; IFeatureCursor cursor = routesClass.Search(null, true); IFeature feature = cursor.NextFeature(); IPolyline outputRoute = feature.Shape as IPolyline; Then just pass your outputRoute to the method you made called "IEnumVertexExample", instead of a layer. The outputRoute will not be null when cast as IPointCollection, because a Polyline supports that interface. To tie up the resource center part of this forum post, if you go to the help page for IFeature.Shape, you see that the Shape is returned as an IGeometry. If you follow the link to the IGeometry page, you see that one of the CoClasses that supports IGeometry is a Polyline. And a Polyline is what you need to cast as an IPointCollection. Bingo! We came full circle.
... View more
08-04-2011
08:03 AM
|
0
|
0
|
1069
|
|
POST
|
Your use case appears more suited for iterating over the vertices of the output route geometry. This is not my area of expertise, but I did find the IConstructAngle.ConstructThreePoint method. You would input from, through, and to points, and get the angle value created by the three points. As you iterate the vertices of the route geometry, you can calculate what the next angle is for input to your robot. You also stated, "I have the route saved and displayed as layer ,now should i use that layer file or the result nalayer that is being saved as the result layer(.lyr)" If you do elect to retrieve your route feature using the Routes class in the NALayer, the way I usually get to the associated feature classes is by first retrieving the NAContext from the NALayer via INALayer.Context. Then use INAContext.NAClasses to get your Routes class, like this: INAContext naContext = naLayer.Context; INAClass naClass = naContext.NAClasses.get_ItemByName("Routes") as INAClass; Then you can cast your NAClass as a feature class and iterate over it with IFeatureClass.Search.
... View more
08-03-2011
08:30 AM
|
0
|
0
|
1069
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-14-2015 07:46 AM | |
| 1 | 07-31-2015 09:09 AM | |
| 1 | 04-10-2013 06:58 AM | |
| 2 | 02-14-2018 03:51 PM | |
| 2 | 02-14-2018 02:20 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-19-2021
04:18 PM
|