reneecammarere

Problem with Network Analyst Geoprocessing Tool for creating Route layer

Discussion created by reneecammarere on Mar 8, 2011
When I test the following snippit of code, the Network Dataset is placed on the map.  However the Route layer is not created and placed on the map.  Am I not using these objects properly?

            // Call the routine that builds the Network Dataset and adds it to the map
            ILayer pNetworkLayer = MarksNDExperiment();
            Geoprocessor myGP = new Geoprocessor();
            bool addOutputsToMap = myGP.AddOutputsToMap;
            addOutputsToMap = true;

            // Run the geoprocessing tool for making the Route Layer
            IVariantArray parameters = new VarArray();
            parameters.Add(pNetworkLayer);
            parameters.Add("Route");//name of Route layer
            parameters.Add("Length");//impedance attribute or cost attribute
            myGP.Execute("MakeRouteLayer_na", parameters, null);

It doesn't seem to matter if I place the ND on the map inside of the routine MarksNDExperiment() or at the end of this snippit of code.  It still doesn't show up on the map.

Thanks,
Renee

Outcomes