ArcObjects Library Reference

Statements - Set Service Area Properties Snippet

Set service area solver parameters.

[C#]

//<-- Snippet Start -->
// DESCRIPTION:

// Set service area solver parameters, including settings for...
ESRI.ArcGIS.NetworkAnalyst.INAServiceAreaSolver2 naServiceAreaSolver = naSolver as ESRI.ArcGIS.NetworkAnalyst.INAServiceAreaSolver2;

// ...travel direction
naServiceAreaSolver.TravelDirection = ESRI.ArcGIS.NetworkAnalyst.esriNATravelDirection.esriNATravelDirectionFromFacility;

// ...default break values
ESRI.ArcGIS.esriSystem.IDoubleArray defaultBreaks = naServiceAreaSolver.DefaultBreaks;
defaultBreaks.Add(5.0);
naServiceAreaSolver.DefaultBreaks = defaultBreaks;

// ...line generation
naServiceAreaSolver.OutputLines = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputLineType.esriNAOutputLineTrueShape;
naServiceAreaSolver.IncludeSourceInformationOnLines = false;
naServiceAreaSolver.OverlapLines = true;
naServiceAreaSolver.SplitLinesAtBreaks = false;

// ...polygon generation
naServiceAreaSolver.OutputPolygons = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputPolygonType.esriNAOutputPolygonSimplified;
naServiceAreaSolver.MergeSimilarPolygonRanges = false;
naServiceAreaSolver.OverlapPolygons = true;
naServiceAreaSolver.SplitPolygonsAtBreaks = true;
naServiceAreaSolver.TrimOuterPolygon = true;
naServiceAreaSolver.TrimPolygonDistance = 100.0;
naServiceAreaSolver.TrimPolygonDistanceUnits = ESRI.ArcGIS.esriSystem.esriUnits.esriMeters;

// ...sources excluded from polygon generation
ESRI.ArcGIS.esriSystem.IStringArray excludedSources = naServiceAreaSolver.ExcludeSourcesFromPolygons;
excludedSources.Add("Railroads");
naServiceAreaSolver.ExcludeSourcesFromPolygons = excludedSources;

//<-- Snippet End -->
[Visual Basic .NET]

'<-- Snippet Start -->
' DESCRIPTION:

' Set service area solver parameters, including settings for...
Dim naServiceAreaSolver As ESRI.ArcGIS.NetworkAnalyst.INAServiceAreaSolver2 = CType(naSolver, ESRI.ArcGIS.NetworkAnalyst.INAServiceAreaSolver2)

' ...travel direction
naServiceAreaSolver.TravelDirection = ESRI.ArcGIS.NetworkAnalyst.esriNATravelDirection.esriNATravelDirectionFromFacility

' ...default break values
Dim defaultBreaks As ESRI.ArcGIS.esriSystem.IDoubleArray = naServiceAreaSolver.DefaultBreaks
defaultBreaks.Add(5.0)
naServiceAreaSolver.DefaultBreaks = defaultBreaks

' ...line generation
naServiceAreaSolver.OutputLines = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputLineType.esriNAOutputLineTrueShape
naServiceAreaSolver.IncludeSourceInformationOnLines = False
naServiceAreaSolver.OverlapLines = True
naServiceAreaSolver.SplitLinesAtBreaks = False

' ...polygon generation
naServiceAreaSolver.OutputPolygons = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputPolygonType.esriNAOutputPolygonSimplified
naServiceAreaSolver.MergeSimilarPolygonRanges = False
naServiceAreaSolver.OverlapPolygons = True
naServiceAreaSolver.SplitPolygonsAtBreaks = True
naServiceAreaSolver.TrimOuterPolygon = True
naServiceAreaSolver.TrimPolygonDistance = 100.0
naServiceAreaSolver.TrimPolygonDistanceUnits = ESRI.ArcGIS.esriSystem.esriUnits.esriMeters

' ...sources excluded from polygon generation
Dim excludedSources As ESRI.ArcGIS.esriSystem.IStringArray = naServiceAreaSolver.ExcludeSourcesFromPolygons
excludedSources.Add("Railroads")
naServiceAreaSolver.ExcludeSourcesFromPolygons = excludedSources

'<-- Snippet End -->


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.NetworkAnalyst
  • ESRI.ArcGIS.System