Label | Explanation | Data Type |
Input Transit Feature Dataset
| A feature dataset containing the Stops and LineVariantElements feature classes from the Network Analyst public transit data model. The feature dataset's parent geodatabase must contain the public transit data model's LineVariants, Schedules, ScheduleElements, and Runs tables and the Calendars table, the CalendarExceptions table, or both. A valid feature dataset with its associated feature classes and tables can be created from General Transit Feed Specification (GTFS) public transit data using the GTFS To Public Transit Data Model tool. | Feature Dataset |
Analysis Type
| Specifies the location type for which the tool will calculate the frequency of public transit service.
| String |
Output Feature Class
| The output feature class. A shapefile is not a valid value. | Feature Class |
Time Windows
| The periods of time for which public transit service frequency will be calculated. Multiple time windows can be specified. The output feature class will include a set of fields representing the transit frequency statistics for each time window. These fields will be prefixed by the value specified in the Output Field Prefix column. Time windows can be interpreted either as specific dates or as generic weekdays. The Use Specific Date column determines whether the date component of the Start Datetime column will be interpreted as an exact date or as a generic weekday. For example, if the date component of the Start Datetime value is December 25, 2021, and Use Specific Date is True, the exact date will be used, and the public transit service frequency calculated will include any special service added or removed for the Christmas holiday. If Use Specific Date is False, this date will be interpreted as Saturday, and the public transit service frequency calculated will include regular service for any typical Saturday. For specific dates, all exceptions to the regular public transit service included in the CalendarExceptions table and the date range defined in the Calendars table will be considered. For a generic weekday, only regular service defined in the weekday fields in the Calendars table will be considered. Learn more about the tables in the public transit data model
| Value Table |
Separate Counts By Transit Line
(Optional) | Specifies whether service from multiple transit lines using the same stop or corridor will be separated by transit line or combined when calculating transit frequency statistics. When separated by transit line, the output will contain a copy of each stop or transit line segment for each unique transit line using the stop or corridor, and these duplicated features will have overlapping geometry. If the LineVariants table in the input data has the optional GDirectionID field, the output will additionally separate counts by the GDirectionID field value. For example, if a stop serves both direction of travels along the same line, the output will contain a copy of the stop for each direction of travel as defined by the GDirectionID field.
This parameter only applies when the Analysis Type parameter is set to Transit stops or Transit lines. | Boolean |
Input Points of Interest
(Optional) | The points of interest for which the frequency of available public transit service will be calculated. If a polygon layer is specified, the public transit service available at the polygon centroids will be used. This parameter is required when the Analysis Type parameter is set to Points of interest; otherwise, it is ignored. | Feature Layer |
Network Data Source
(Optional) | The network dataset or service that will be used to determine the public transit stops within range of the designated points of interest or to calculate the polygon areas within range of public transit stops. You can use a catalog path to a network dataset, a network dataset layer object, the string name of the network dataset layer, or a portal URL for a network analysis service. The network must have at least one travel mode. To use a portal URL, you must be signed in to the portal with an account that has routing privileges. Running the tool will consume credits if you use ArcGIS Online as the network data source. Note:Use a network dataset appropriate for modeling passengers traveling to and from public transit stops. Don't use a network dataset configured to use public transit data with the Public Transit evaluator because this type of network models passengers riding public transit, not people traveling to and from the public transit stops. This parameter is required when the Analysis Type parameter is set to Points of interest or Areas; otherwise, it is ignored. | Network Data Source |
Travel Mode (Optional) | The travel mode on the network data source that will be used to determine the public transit stops within range of the designated points of interest or to calculate the polygon areas within range of public transit stops. You can specify the travel mode as a string name of the travel mode or as an arcpy.nax.TravelMode object. Use the travel mode most appropriate for modeling passengers traveling to and from public transit stops. Typically, a travel mode that models walking time or distance should be used. Note:Do not use a travel mode with an impedance attribute that uses the Public Transit evaluator because that travel mode models passengers riding public transit, not passengers traveling to and from the public transit stops. This parameter is required when the Analysis Type parameter is set to Points of interest or Areas; otherwise, it is ignored. | Network Travel Mode |
Maximum travel time or distance to stops
(Optional) | The impedance limit that will be used when finding the public transit stops within range of points of interest or when calculating the area reachable from public transit stops. This parameter should be specified in the units designated in the Units of maximum travel time or distance to stops parameter. This parameter is required when the Analysis Type parameter is set to Points of interest or Areas; otherwise, it is ignored. | Double |
Units of travel time or distance to stops
(Optional) | Specifies the units that will be used for the impedance limit specified in the Maximum travel time or distance to stops parameter. The available units depend on the value specified in the Travel Mode parameter. If the travel mode's impedance has units of time, only time-based units will be available. If the travel mode's impedance has units of distance, only distance-based units will available. If the travel mode's impedance units are neither time based nor distance based, the only option available will be unknown units, and the Maximum travel time or distance to stops parameter value will be in the units of the travel mode's impedance. This parameter is required when the Analysis Type parameter is set to Points of interest or Areas; otherwise, it is ignored. Tip:It is recommended that you use a distance-based travel limit when calculating public transit service frequency for points of interest. With a distance-based limit, the tool can reduce the OD cost matrix size in advance using a simple straight-line distance selection. This may eliminate some origins and destinations from the OD cost matrix analysis and improve performance. If the network data source is a service that charges credits, this optimization also reduces the number of credits needed.
| String |
Cell Size
(Optional) | The size (edge length) of cells that will be used to represent the area reachable from transit stops in the tool output. The numerical value and the units are set using this parameter. When calculating the area reachable from public transit stops, a service area is calculated. The resulting service area polygons, which often overlap, are simplified into a raster-like polygon feature class composed of square cells of the size specified in this parameter. The public transit service frequency statistics are calculated for each of these cells based on the public transit stops whose service area polygons overlap the cell centroid. Use a cell size relevant to how pedestrians travel in the real world. For example, you can base the cell size on the size of city blocks or parcels or the distance a pedestrian can walk in less than a minute. Smaller cells are more accurate but take longer to process. The default is 80 meters. This parameter is required when the Analysis Type parameter is set to Areas; otherwise, it is ignored. | Linear Unit |
Barriers
(Optional) | The point, line, or polygon features that will be used as barriers in the network analysis when calculating the public transit stops within range of the designated points of interest or when calculating the polygon areas within range of public transit stops. This parameter is relevant only when the Analysis Type parameter is set to Points of interest or Areas; otherwise, it is ignored. | Feature Layer |
Summary
Calculates the frequency of scheduled public transit service available within one or more specified time windows at public transit stops, along public transit lines, at points of interest, or in areas.
Usage
This tool can calculate public transit frequency statistics at or along the following types of locations:
- Public transit stops.
- Public transit line segments between pairs of connected stops.
- Specified points of interest using the stops within a specified travel time or distance.
- All areas within a specified travel time or distance of public transit stops. This option generates a coverage map of your transit system with frequency statistics included.
When calculating public transit frequency statistics along transit lines, the Output Feature Class parameter value is a copy of the Network Analyst public transit data model's LineVariantElements feature class from the Input Transit Feature Dataset parameter value. The transit lines in this feature class do not represent the actual geographic paths taken by buses, trains, or other public transit vehicles but are instead representative of logical connections between stops in the transit system. If this feature class is generated by the GTFS To Public Transit Data Model tool, these features will be straight lines connecting stops and will not follow the underlying street features. Thus, the output of this tool may not be suitable for cartographic purposes.
When calculating public transit frequency statistics for points of interest, the tool performs a Network Analyst OD cost matrix calculation to identify the public transit stops within range of the points of interest. When calculating public transit frequency statistics for areas, the tool performs a Network Analyst service area calculation to identify the areas of town within range of public transit stops. You must specify a road network as the Network Data Source parameter value to use either of these Network Analyst calculations. The options for the road network are as follows:
- A network dataset—This option requires the ArcGIS Network Analyst extension and a network dataset.
- A portal service—This option requires an ArcGIS Online account with routing privileges and sufficient credits or a portal with an ArcGIS Enterprise routing service configured. You must be signed in to the portal before running the tool.
The tool will typically run faster when using a network dataset compared to a service, particularly if the size of the problem exceeds the analysis limits of the service so that the tool must split the inputs into chunks. Additionally, tool performance will be better when using a network dataset in a mobile geodatabase compared to a network dataset in a file geodatabase. A file geodatabase can be converted to a mobile geodatabase using the Create Mobile Map Package tool.
When calculating public transit frequency statistics for points of interest using a service with analysis limits, if the number of inputs is large enough to exceed the service's number of allowed inputs, the tool will split the inputs into chunks. If the travel limit is based on distance, the tool will perform a simple straight-line selection for each chunk to eliminate origins and destinations that are far from one another, reducing the overall problem size and improving performance. When this is the case, you can further reduce the problem size by spatially sorting the input data using the Sort tool with the Peano curve sort method prior to running the Calculate Transit Service Frequency tool. Sorted data yields clustered chunks, which increases the likelihood of eliminating a larger number of irrelevant destinations for each chunk of origins. Sorting the data does not yield performance benefits for other analysis types, if the travel limit is not specified with units of distance, if the number of inputs does not exceed the service limits, or if you are not using a service as the network data source. See the origin and destination limits for the ArcGIS Online OD Cost Matrix service for more information.
Tool performance varies with the analysis type and the following factors:
- Calculating transit frequency statistics at transit stops or along transit lines is much faster than calculating transit frequency statistics at points of interest or in areas.
- When calculating public transit service frequency for areas, the tool's run time increases for larger numbers of public transit stops, larger travel time or distance limits, and smaller cell sizes.
- When calculating public transit service frequency for points of interest, the tool's run time increases for larger numbers of public transit stops, larger numbers of points of interest, and larger travel time or distance limits. It is recommended that you use a distance limit instead of a time limit because the tool can reduce the OD cost matrix problem size in advance using a simple straight-line distance selection.
- As discussed above, the tool runs fastest using a network dataset in a mobile geodatabase as the network data source.
When calculating public transit frequency statistics for points of interest or areas, the tool first identifies the public transit stops that are within range of each point of interest or area. It then calculates the transit frequency statistics for the point or area by combining the available service for the collection of stops within range. The tool does not double count service. For example, if a point of interest is within range of two stops along the same transit line, service along this line is only counted once.
When calculating public transit frequency statistics for areas, the tool calculates service area polygons around all transit stops in the system as described above. It then simplifies the service area polygons, which often overlap and have complex geometry, using a rasterization and sampling approach. The final output contains square-shaped polygons of the specified cell size. Each polygon feature represents a unit of area assumed to have an equal level of public transit service. The set of public transit stops considered to serve each cell is determined using the intersecting service area polygons. For example, if the centroid of a particular cell intersects the service area polygons generated by three different stops, that cell is considered to be served by each of those three stops. In other words, each cell is served by all stops within a short walk time or distance, not stops physically located within the boundaries of the polygon.
For each time window, the Output Feature Class parameter value will include the following fields in which [prefix] refers to the Output Field Prefix value for the Time Windows parameter:
- [prefix]_NumRuns—The total number of public transit runs that serve the stop, run along the line, or are accessible to the point of interest or area during the specified time window. A run represents a unique instance of a transit vehicle making a series of scheduled stops and is equivalent to a GTFS trip.
- [prefix]_NumRunsPerHour—The average number of public transit runs per hour. This is calculated by dividing the number of runs by the duration of the time window.
- [prefix]_AvgHeadway—The average time in minutes between runs at the stop, along the line, at the point of interest, or in the designated polygon area during the specified time window. If separating counts by line, the headway represents the time between visits of the same public transit route. Otherwise, the tool combines runs of different routes, even if those routes go to different destinations. This field will be null if the average headway cannot be calculated, for example, if there is only one run serving the stop during the time window.
- [prefix]_MinHeadway—The shortest time in minutes between runs during the time window. If separating counts by line, the headway represents the time between visits of the same public transit route. Otherwise, the tool combines runs of different routes, even if those routes go to different destinations. This field will be null if the average headway cannot be calculated, for example, if there is only one run serving the stop during the time window.
- [prefix]_MaxHeadway—The longest time in minutes between runs during the time window. If separating counts by line, the headway represents the time between visits of the same public transit route. Otherwise, the tool combines runs of different routes, even if those routes go to different destinations. This field will be null if the average headway cannot be calculated, for example, if there is only one run serving the stop during the time window.
- [prefix]_NumLines—The number of unique public transit lines that have service during the time window and contributed to the statistics calculated in the other fields. For example, if you combine service for all transit lines, a particular stop might have a value of 3 for this field because three different bus lines shared the stop during the time window. For a different time of day, that stop might have a value of 2 for this field because one of the lines has no service at that time.
When calculating public transit service frequency statistics at public transit stops and separating the count statistics by transit line, the Output Feature Class parameter value will include a field named LineID to indicate the transit line that these statistics reference. The LineID field values correspond to the ID field values in the Lines table in the Network Analyst public transit data model. The output feature class may also contain a field named GDirectionID corresponding to the GDirectionID field in the input LineVariants table.
When calculating public transit service frequency statistics for points of interest or areas, the Output Feature Class parameter value will include a field named NumStops. This field represents the number of transit stops within the specified walk limit of the point of interest or polygon area.
The tool adds the time window settings and their associated field prefixes to the metadata of the Output Feature Class parameter value.
If there is no public transit service during the specified time window, the tool will add the output fields and complete successfully. The fields values will be set to 0 or Null reflecting the lack of service, and a warning message appears indicating that there was no service.
When calculating transit frequency statistics for points of interest, you can use a polygon feature class as input, and the tool will calculate the public transit frequency statistics at the centroids of those polygons. The tool's output will be a copy of the input polygons with the transit frequency statistics fields added. Polygon inputs are useful in calculating the frequency of transit service for parcels or census blocks. However, the centroid of a polygon is only a good representation of that polygon if the polygon is small with respect to the distance a traveler can walk in a short period of time. It is not appropriate, for example, to use census tracts since tracts are typically very large on a pedestrian scale.
This tool is based on open source tools developed by Esri with contributions from David Wasserman of Fehr & Peers under an Apache 2.0 license.
Parameters
arcpy.transit.CalculateTransitServiceFrequency(in_transit_feature_dataset, analysis_type, out_feature_class, time_windows, {separate_counts_by_line}, {in_points_of_interest}, {network_data_source}, {travel_mode}, {travel_limit}, {travel_limit_units}, {cell_size}, {barriers})
Name | Explanation | Data Type |
in_transit_feature_dataset | A feature dataset containing the Stops and LineVariantElements feature classes from the Network Analyst public transit data model. The feature dataset's parent geodatabase must contain the public transit data model's LineVariants, Schedules, ScheduleElements, and Runs tables and the Calendars table, the CalendarExceptions table, or both. A valid feature dataset with its associated feature classes and tables can be created from General Transit Feed Specification (GTFS) public transit data using the GTFS To Public Transit Data Model tool. | Feature Dataset |
analysis_type | Specifies the location type for which the tool will calculate the frequency of public transit service.
| String |
out_feature_class | The output feature class. A shapefile is not a valid value. | Feature Class |
time_windows [[Use Specific Date; Start Datetime; Duration (minutes); Count Arrivals or Departures; Output Field Prefix],...] | The periods of time for which public transit service frequency will be calculated. Multiple time windows can be specified. The output feature class will include a set of fields representing the transit frequency statistics for each time window. These fields will be prefixed by the value specified in the Output Field Prefix column. Time windows can be interpreted either as specific dates or as generic weekdays. The Use Specific Date column determines whether the date component of the Start Datetime column will be interpreted as an exact date or as a generic weekday. For example, if the date component of the Start Datetime value is December 25, 2021, and Use Specific Date is True, the exact date will be used, and the public transit service frequency calculated will include any special service added or removed for the Christmas holiday. If Use Specific Date is False, this date will be interpreted as Saturday, and the public transit service frequency calculated will include regular service for any typical Saturday. For specific dates, all exceptions to the regular public transit service included in the CalendarExceptions table and the date range defined in the Calendars table will be considered. For a generic weekday, only regular service defined in the weekday fields in the Calendars table will be considered. Learn more about the tables in the public transit data model
| Value Table |
separate_counts_by_line (Optional) | Specifies whether service from multiple transit lines using the same stop or corridor will be separated by transit line or combined when calculating transit frequency statistics. When separated by transit line, the output will contain a copy of each stop or transit line segment for each unique transit line using the stop or corridor, and these duplicated features will have overlapping geometry. If the LineVariants table in the input data has the optional GDirectionID field, the output will additionally separate counts by the GDirectionID field value. For example, if a stop serves both direction of travels along the same line, the output will contain a copy of the stop for each direction of travel as defined by the GDirectionID field.
This parameter only applies when the analysis_type parameter is set to STOPS or LINES. | Boolean |
in_points_of_interest (Optional) | The points of interest for which the frequency of available public transit service will be calculated. If a polygon layer is specified, the public transit service available at the polygon centroids will be used. This parameter is required when the analysis_type parameter is set to POINTS_OF_INTEREST; otherwise, it is ignored. | Feature Layer |
network_data_source (Optional) | The network dataset or service that will be used to determine the public transit stops within range of the designated points of interest or to calculate the polygon areas within range of public transit stops. You can use a catalog path to a network dataset, a network dataset layer object, the string name of the network dataset layer, or a portal URL for a network analysis service. The network must have at least one travel mode. To use a portal URL, you must be signed in to the portal with an account that has routing privileges. Running the tool will consume credits if you use ArcGIS Online as the network data source. Learn more about estimating credit usage for this tool Note:Use a network dataset appropriate for modeling passengers traveling to and from public transit stops. Don't use a network dataset configured to use public transit data with the Public Transit evaluator because this type of network models passengers riding public transit, not people traveling to and from the public transit stops. This parameter is required when the analysis_type parameter is set to POINTS_OF_INTEREST or AREAS; otherwise, it is ignored. | Network Data Source |
travel_mode (Optional) | The travel mode on the network data source that will be used to determine the public transit stops within range of the designated points of interest or to calculate the polygon areas within range of public transit stops. You can specify the travel mode as a string name of the travel mode or as an arcpy.nax.TravelMode object. Use the travel mode most appropriate for modeling passengers traveling to and from public transit stops. Typically, a travel mode that models walking time or distance should be used. Note:Do not use a travel mode with an impedance attribute that uses the Public Transit evaluator because that travel mode models passengers riding public transit, not passengers traveling to and from the public transit stops. This parameter is required when the analysis_type parameter is set to POINTS_OF_INTEREST or AREAS; otherwise, it is ignored. | Network Travel Mode |
travel_limit (Optional) | The impedance limit that will be used when finding the public transit stops within range of points of interest or when calculating the area reachable from public transit stops. This parameter should be specified in the units designated in the travel_limit_units parameter. This parameter is required when the analysis_type parameter is set to POINTS_OF_INTEREST or AREAS; otherwise, it is ignored. | Double |
travel_limit_units (Optional) | Specifies the units that will be used for the impedance limit specified in the travel_limit parameter. The available units depend on the value specified in the travel_mode parameter. If the travel mode's impedance has units of time, only time-based units will be available. If the travel mode's impedance has units of distance, only distance-based units will be available. If the travel mode's impedance units are neither time based nor distance based, the only option available will be unknown units, and the travel_limit parameter value will be in the units of the travel mode's impedance.
This parameter is required when the analysis_type parameter is set to POINTS_OF_INTEREST or AREAS; otherwise, it is ignored. Tip:It is recommended that you use a distance-based travel limit when calculating public transit service frequency for points of interest. With a distance-based limit, the tool can reduce the OD cost matrix size in advance using a simple straight-line distance selection. This may eliminate some origins and destinations from the OD cost matrix analysis and improve performance. If the network data source is a service that charges credits, this optimization also reduces the number of credits needed. | String |
cell_size (Optional) | The size (edge length) of cells that will be used to represent the area reachable from transit stops in the tool output. The numerical value and the units are set using this parameter. When calculating the area reachable from public transit stops, a service area is calculated. The resulting service area polygons, which often overlap, are simplified into a raster-like polygon feature class composed of square cells of the size specified in this parameter. The public transit service frequency statistics are calculated for each of these cells based on the public transit stops whose service area polygons overlap the cell centroid. Use a cell size relevant to how pedestrians travel in the real world. For example, you can base the cell size on the size of city blocks or parcels or the distance a pedestrian can walk in less than a minute. Smaller cells are more accurate but take longer to process. The default is 80 meters. This parameter is required when the analysis_type parameter is set to AREAS; otherwise, it is ignored. | Linear Unit |
barriers [barriers,...] (Optional) | The point, line, or polygon features that will be used as barriers in the network analysis when calculating the public transit stops within range of the designated points of interest or when calculating the polygon areas within range of public transit stops. This parameter is relevant only when the analysis_type parameter is set to POINTS_OF_INTEREST or AREAS; otherwise, it is ignored. | Feature Layer |
Code sample
The following code snippet demonstrates how to calculate transit frequency statistics at public transit stops for multiple time windows.
import datetime
arcpy.transit.CalculateTransitServiceFrequency(
r"C:\Data\TransitData.gdb\Transit",
"STOPS",
r"C:\Data\Output.gdb\FrequencyAtStops",
[
[False, datetime.datetime(2021, 6, 30, 7, 0, 0), 120, "DEPARTURES", "AMRush"], # 7:00 - 9:00 AM
[False, datetime.datetime(2021, 6, 30, 16, 0, 0), 120, "DEPARTURES", "PMRush"], # 4:00 - 6:00 PM
[False, datetime.datetime(2021, 6, 30, 22, 0, 0), 120, "DEPARTURES", "LateNight"], # 10:00 PM - midnight
[True, datetime.datetime(2021, 7, 4, 10, 0, 0), 240, "DEPARTURES", "July4Holiday"], # 7:00 - 9:00 AM, holiday
],
separate_counts_by_line=True
)
The following code snippet demonstrates how to calculate transit frequency statistics at points of interest using a network dataset as the network data source.
import datetime
arcpy.transit.CalculateTransitServiceFrequency(
r"C:\Data\TransitData.gdb\Transit",
"POINTS_OF_INTEREST",
r"C:\Data\Output.gdb\Supermarkets_Frequency",
[[False, datetime.datetime(2021, 6, 30, 7, 0, 0), 120, "DEPARTURES", "AMRush"]],
in_points_of_interest=r"C:\Data\Input.gdb\Supermarkets",
network_data_source=r"C:\Data\NorthAmerica.gdb\Routing\Routing_ND",
travel_mode="Walking Distance",
travel_limit=0.25,
travel_limit_units="MILES"
)
The following code snippet demonstrates how to calculate transit frequency statistics for areas using ArcGIS Online as the network data source and a travel time limit of 10 minutes.
import datetime
arcpy.transit.CalculateTransitServiceFrequency(
r"C:\Data\TransitData.gdb\Transit",
"AREAS",
r"C:\Data\Output.gdb\TransitSystemCoverage",
[[True, datetime.datetime(2021, 6, 30, 7, 0, 0), 120, "ARRIVALS", "June30AM"]],
"",
None,
"https://www.arcgis.com/",
"Walking Time",
10,
"MINUTES",
"100 Meters"
)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes