Class ServiceAreaParameters

java.lang.Object
com.esri.arcgisruntime.tasks.networkanalysis.ServiceAreaParameters

public final class ServiceAreaParameters extends Object
Represents input parameters for computing service area using ServiceAreaTask. Use ServiceAreaTask.createDefaultParametersAsync() to get an instance of this class that is initialized with smart default values based on the task's metadata ServiceAreaTask.getServiceAreaTaskInfo().

To set the service area facilities and barriers (point, polyline or polygon) for solving a service area, you can use the following methods setFacilities(Iterable), setPointBarriers(Iterable), setPolylineBarriers(Iterable) or setPolygonBarriers(Iterable).

 List<ServiceAreaFacility> facilities = new ArrayList<ServiceAreaFacility>();
 facilities.add(new ServiceAreaFacility(new Point(-13052490.008, 4035542.739, SpatialReferences.getWebMercator())));
 mServiceAreaParameters.setFacilities(facilities);
 

You can also set service area facilities and barriers by executing queries on a FeatureTable and extracting the service area facilities or barriers from features within the table, using setFacilities(ArcGISFeatureTable, QueryParameters), setPointBarriers(ArcGISFeatureTable, QueryParameters), setPolylineBarriers(ArcGISFeatureTable, QueryParameters), and setPolygonBarriers(ArcGISFeatureTable, QueryParameters).

Since:
100.1.0
  • Method Details

    • getAccumulateAttributeNames

      public List<String> getAccumulateAttributeNames()
      Gets a list of network attributes to be accumulated and returned as part of the service area.

      For example, accumulateAttributeNames = {"Miles", "Kilometers"} indicates that the total cost of the service area should also be calculated in miles and kilometers. All supported attributes can be obtained from ServiceAreaTaskInfo.getCostAttributes().

      Returns:
      a modifiable list of accumulate attribute names
      Since:
      100.1.0
      See Also:
    • getTravelMode

      public TravelMode getTravelMode()
      Gets the travel mode that was set.
      Returns:
      the travel mode or a default if not set
      Since:
      100.1.0
    • setTravelMode

      public void setTravelMode(TravelMode travelMode)
      Sets the travel mode.
      Parameters:
      travelMode - the travel mode
      Throws:
      IllegalArgumentException - if travelMode is null
      Since:
      100.1.0
    • getStartTime

      public Calendar getStartTime()
      Gets the start time that was set. If not specified the default value will be null and the start time used will be the time at which the task executes.
      Returns:
      the start time. Returns null if it was not set
      Since:
      100.1.0
      See Also:
    • setStartTime

      public void setStartTime(Calendar startTime)
      Sets the start time. If not specified, defaults to the time the task is executed.
      Parameters:
      startTime - start time, can be null
      Since:
      100.1.0
      See Also:
    • getOutputSpatialReference

      public SpatialReference getOutputSpatialReference()
      Gets the spatial reference in which the result geometries are returned.
      Returns:
      the output spatial reference
      Since:
      100.1.0
      See Also:
    • setOutputSpatialReference

      public void setOutputSpatialReference(SpatialReference outputSpatialReference)
      Sets the spatial reference in which the result geometries should be returned. If not specified then the results will be returned in the spatial reference specified by ServiceAreaTaskInfo.getOutputSpatialReference().
      Parameters:
      outputSpatialReference - the output spatial reference
      Throws:
      IllegalArgumentException - if outputSpatialReference is null
      Since:
      100.1.0
      See Also:
    • getDefaultImpedanceCutoffs

      public List<Double> getDefaultImpedanceCutoffs()
      Gets the default impedance cutoffs.

      Cutoffs specify the quantity of the impedance to apply. They constrain the extent of the service area to be calculated. For example, if you apply breaks of 5, 10, and 15 when the impedance is set to Time, the service area will include those streets that can be reached within 5, 10, and 15 minutes. The units for impedance cutoffs is based on the value of the TravelMode.getImpedanceAttributeName(). For example, if TravelMode.getImpedanceAttributeName() is TravelTime, the defaultImpedanceCutoffs are specified in minutes.

      Returns:
      a modifiable list of default impedance cutoffs
      Since:
      100.1.0
      See Also:
    • getTravelDirection

      public TravelDirection getTravelDirection()
      Gets the travel direction.
      Returns:
      the travel direction
      Since:
      100.1.0
      See Also:
    • setTravelDirection

      public void setTravelDirection(TravelDirection travelDirection)
      Sets the travel direction.
      Parameters:
      travelDirection - the travel direction
      Throws:
      IllegalArgumentException - if travelDirection is null
      Since:
      100.1.0
      See Also:
    • getPolygonBufferDistance

      public double getPolygonBufferDistance()
      Gets the service area polygon buffer distance in meters.

      The polygon buffer refers to the distance from the road the service area polygon should extend when no other reachable roads are nearby, similar to a line buffer size. This is useful if the network is very sparse and you don't want the service area to cover large areas where there are no features.

      Returns:
      the polygon buffer distance in meters
      Since:
      100.1.0
      See Also:
    • setPolygonBufferDistance

      public void setPolygonBufferDistance(double polygonBufferDistance)
      Sets the service area polygon buffer distance in meters.

      The polygon buffer refers to the distance from the road the service area polygon should extend when no other reachable roads are nearby, similar to a line buffer size. This is useful if the network is very sparse and you don't want the service area to cover large areas where there are no features.

      Parameters:
      polygonBufferDistance - the polygon buffer distance in meters
      Since:
      100.1.0
      See Also:
    • getPolygonDetail

      public ServiceAreaPolygonDetail getPolygonDetail()
      Gets the level of detail of the output polygons.

      If your analysis covers an urban area with a grid-like street network, the difference between generalized and standard polygons will be minimal. However, for mountain and rural roads, the standard and detailed polygons may present significantly more accurate results than generalized polygons.

      Returns:
      the level of detail of the output polygons
      Since:
      100.1.0
      See Also:
    • setPolygonDetail

      public void setPolygonDetail(ServiceAreaPolygonDetail polygonDetail)
      Sets the level of detail of the output polygons.

      If your analysis covers an urban area with a grid-like street network, the difference between generalized and standard polygons will be minimal. However, for mountain and rural roads, the standard and detailed polygons may present significantly more accurate results than generalized polygons.

      Parameters:
      polygonDetail - the level of detail of the output polygons
      Throws:
      IllegalArgumentException - if polygonDetail is null
      Since:
      100.1.0
      See Also:
    • getGeometryAtOverlap

      public ServiceAreaOverlapGeometry getGeometryAtOverlap()
      Gets the geometry overlap behavior.

      Specifies the behavior of service area output from multiple facilities in relation to one another.

      Returns:
      the behavior for overlapping geometry
      Since:
      100.1.0
      See Also:
    • setGeometryAtOverlap

      public void setGeometryAtOverlap(ServiceAreaOverlapGeometry geometryAtOverlap)
      Sets the geometry overlap behavior.

      Specifies the behavior of service area output from multiple facilities in relation to one another.

      Parameters:
      geometryAtOverlap - the behavior for overlapping geometry
      Throws:
      IllegalArgumentException - if geometryAtOverlap is null
      Since:
      100.1.0
      See Also:
    • getGeometryAtCutoff

      public ServiceAreaPolygonCutoffGeometry getGeometryAtCutoff()
      Gets the behavior for the geometry at cutoff.

      Specifies the behavior of service area output for a single facility when multiple cutoff values are specified. This parameter does not apply to line output.

      Returns:
      the behavior for geometry at cutoff
      Since:
      100.1.0
    • setGeometryAtCutoff

      public void setGeometryAtCutoff(ServiceAreaPolygonCutoffGeometry geometryAtCutoff)
      Sets the behavior for the geometry at cutoff.

      Specifies the behavior of service area output for a single facility when multiple cutoff values are specified. This parameter does not apply to line output.

      Parameters:
      geometryAtCutoff - the behavior for geometry at cutoff
      Throws:
      IllegalArgumentException - if geometryAtCutoff is null
      Since:
      100.1.0
    • isReturnPointBarriers

      public boolean isReturnPointBarriers()
      Indicates if point barriers will be returned in the result ServiceAreaResult.getPointBarriers().
      Returns:
      true if returning point barriers in the result is enabled, false otherwise
      Since:
      100.1.0
    • setReturnPointBarriers

      public void setReturnPointBarriers(boolean returnPointBarriers)
      Sets whether to return point barriers used while computing service areas, in the result ServiceAreaResult.getPointBarriers().
      Parameters:
      returnPointBarriers - true to return point barriers, otherwise false
      Since:
      100.1.0
    • isReturnPolylineBarriers

      public boolean isReturnPolylineBarriers()
      Indicates if polyline barriers will be returned in the result ServiceAreaResult.getPolylineBarriers().
      Returns:
      true if returning polyline barriers in the result is enabled, false otherwise
      Since:
      100.1.0
    • setReturnPolylineBarriers

      public void setReturnPolylineBarriers(boolean returnPolylineBarriers)
      Sets whether to return polyline barriers used while computing service areas, in the result ServiceAreaResult.getPolylineBarriers().
      Parameters:
      returnPolylineBarriers - true to return polyline barriers, otherwise false
      Since:
      100.1.0
    • isReturnPolygonBarriers

      public boolean isReturnPolygonBarriers()
      Indicates if polygon barriers will be returned in the result ServiceAreaResult.getPolygonBarriers().
      Returns:
      true if returning polygon barriers in the result is enabled, false otherwise
      Since:
      100.1.0
    • setReturnPolygonBarriers

      public void setReturnPolygonBarriers(boolean returnPolygonBarriers)
      Sets whether to return polygon barriers used while computing service areas, in the result ServiceAreaResult.getPolygonBarriers().
      Parameters:
      returnPolygonBarriers - true to return polygon barriers, otherwise false
      Since:
      100.1.0
    • isReturnPolylines

      public boolean isReturnPolylines()
      Indicates if polylines will be returned in the result ServiceAreaResult.getResultPolylines(int).
      Returns:
      true if returning polylines in the result is enabled, false otherwise
      Since:
      100.1.0
    • setReturnPolylines

      public void setReturnPolylines(boolean returnPolylines)
      Sets whether to return polylines used while computing service areas, in the result ServiceAreaResult.getResultPolylines(int).
      Parameters:
      returnPolylines - true to return polylines, otherwise false
      Since:
      100.1.0
    • isReturnPolygons

      public boolean isReturnPolygons()
      Indicates if polygons will be returned in the result ServiceAreaResult.getResultPolygons(int).
      Returns:
      true if returning polygons in the result is enabled, false otherwise
      Since:
      100.1.0
    • setReturnPolygons

      public void setReturnPolygons(boolean returnPolygons)
      Sets whether to return polygons used while computing service areas, in the result ServiceAreaResult.getResultPolygons(int).
      Parameters:
      returnPolygons - true to return polygons, otherwise false
      Since:
      100.1.0
    • setFacilities

      public void setFacilities(Iterable<ServiceAreaFacility> facilities)
      Sets the facilities around which service areas are generated.

      Note: calling this method causes any service area facilities set by a previous call or calling setFacilities(ArcGISFeatureTable, QueryParameters) to be cleared.

      Parameters:
      facilities - the service area facilities
      Throws:
      IllegalArgumentException - if facilities is null
      Since:
      100.1.0
    • setFacilities

      public void setFacilities(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
      Sets the facilities around which service areas are generated, using features in a given feature table.

      The feature table can be either local or online and must be of geometry type point. Attributes from the feature table are mapped to the properties on the service area facilities objects generated from the feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until ServiceAreaTask.solveServiceAreaAsync(ServiceAreaParameters) is called.

      Note: calling this method causes any facilities set by a previous call or calling setFacilities(Iterable) to be cleared.

      Parameters:
      featureTable - the feature table
      queryParameters - the query parameters
      Throws:
      IllegalArgumentException - if featureTable or queryParameters is null
      Since:
      100.1.0
    • clearFacilities

      public void clearFacilities()
      Clears any service area facilities that have been set using setFacilities(Iterable) or setFacilities(ArcGISFeatureTable, QueryParameters).
      Since:
      100.1.0
    • setPointBarriers

      public void setPointBarriers(Iterable<PointBarrier> barriers)
      Sets the point barriers to avoid in the result service areas.

      Note: calling this method causes any point barriers set by a previous call or calling setPointBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

      Parameters:
      barriers - the point barriers
      Throws:
      IllegalArgumentException - if barriers is null
      Since:
      100.1.0
    • setPointBarriers

      public void setPointBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
      Sets the point barriers to avoid in the result service areas, using features in a given feature table.

      The feature table can be either local or online and must be of geometry type point. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until ServiceAreaTask.solveServiceAreaAsync(ServiceAreaParameters) is called.

      Note: calling this method causes any point barriers set by a previous call or calling setPointBarriers(Iterable) to be cleared.

      Parameters:
      featureTable - the feature table
      queryParameters - the query parameters
      Throws:
      IllegalArgumentException - if featureTable or queryParameters is null
      Since:
      100.1.0
    • clearPointBarriers

      public void clearPointBarriers()
      Clears any point barriers that have been set using setPointBarriers(Iterable) or setPointBarriers(ArcGISFeatureTable, QueryParameters).
      Since:
      100.1.0
    • setPolylineBarriers

      public void setPolylineBarriers(Iterable<PolylineBarrier> barriers)
      Sets the polyline barriers to avoid in the result service areas.

      Note: calling this method causes any polyline barriers set by a previous call or calling setPolylineBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

      Parameters:
      barriers - the polyline barriers
      Throws:
      IllegalArgumentException - if barriers is null
      Since:
      100.1.0
    • setPolylineBarriers

      public void setPolylineBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
      Sets the polyline barriers to avoid in the result service areas, using features in a given feature table.

      The feature table can be either local or online and must be of geometry type polyline. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until ServiceAreaTask.solveServiceAreaAsync(ServiceAreaParameters) is called.

      Note: calling this method causes any polyline barriers set by a previous call or calling setPolylineBarriers(Iterable) to be cleared.

      Parameters:
      featureTable - the feature table
      queryParameters - the query parameters
      Throws:
      IllegalArgumentException - if featureTable or queryParameters is null
      Since:
      100.1.0
    • clearPolylineBarriers

      public void clearPolylineBarriers()
      Clears any polyline barriers that have been set using setPolylineBarriers(Iterable) or setPolylineBarriers(ArcGISFeatureTable, QueryParameters).
      Since:
      100.1.0
    • setPolygonBarriers

      public void setPolygonBarriers(Iterable<PolygonBarrier> barriers)
      Sets the polygon barriers to avoid in the result service areas.

      Note: calling this method causes any polygon barriers set by a previous call or calling setPolygonBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

      Parameters:
      barriers - the polygon barriers
      Throws:
      IllegalArgumentException - if barriers is null
      Since:
      100.1.0
    • setPolygonBarriers

      public void setPolygonBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
      Sets the polygon barriers to avoid in the result service areas, using features in a given feature table.

      The feature table can be either local or online and must be of geometry type polygon. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until ServiceAreaTask.solveServiceAreaAsync(ServiceAreaParameters) is called.

      Note: calling this method causes any polygon barriers set by a previous call or calling setPolygonBarriers(Iterable) to be cleared.

      Parameters:
      featureTable - the feature table
      queryParameters - the query parameters
      Throws:
      IllegalArgumentException - if featureTable or queryParameters is null
      Since:
      100.1.0
    • clearPolygonBarriers

      public void clearPolygonBarriers()
      Clears any polygon barriers that have been set using setPolygonBarriers(Iterable) or setPolygonBarriers(ArcGISFeatureTable, QueryParameters).
      Since:
      100.1.0
    • getSearchWhereClause

      public String getSearchWhereClause(String sourceName)
      Gets the search where clause from the specified network dataset's source feature class.
      Parameters:
      sourceName - the name of the network dataset's source feature class to retrieve the where clause from
      Returns:
      the search where clause
      Since:
      100.6.0
    • setSearchWhereClause

      public void setSearchWhereClause(String sourceName, String searchWhereClause)
      Sets a search where clause on the specified network dataset's source feature class.

      Only features satisfying the where clause for the specified feature class will be used to locate facilities on the network during the solve operation. If a where clause is not set all network features are used.

      Parameters:
      sourceName - the name of the network dataset's source feature class the where clause will be applied to
      searchWhereClause - the search where clause
      Since:
      100.6.0