API Reference
get_specific_stops(stops, status=None)
Returns a dataframe containing just the specified stops, if present in the NaPTAN dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stops |
Iterable[str]
|
Iterable of the desired stops' ATCO code, as strings. For example: ['2500DCL4060', '1100DEA10139', '068000000322'] |
required |
status |
Optional[str]
|
Return only NaPTAN stops with specific status. Must be one of: None, 'active', 'inactive', or 'pending'. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
pd.DataFrame
|
The specified stops and their attributes. |
get_area_stops(area_codes, status=None)
Returns a dataframe containing all the stops that share the specified area codes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area_codes |
Iterable[Union[str, int]]
|
Iterable of the desired area code. Can be strings or numeric. For example: ['250', '110'] or [250, 110] |
required |
status |
Optional[str]
|
Return only NaPTAN stops with specific status. Must be one of: None, 'active', 'inactive', or 'pending'. |
None
|
Returns:
Type | Description |
---|---|
pd.DataFrame
|
All available stops and their attributes that share the specified area codes. |
get_all_stops(status=None)
Returns a dataframe with all the available nationwide NaPTAN stops.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
status |
Optional[str]
|
Return only NaPTAN stops with specific status. Must be one of: None, 'active', 'inactive', or 'pending'. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
pd.DataFrame
|
All available NaPTAN stops and their attributes in a dataframe. |
export_geojson(df, path)
Export a dataframe of stops as a .json (geoJSON) file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
pd.DataFrame
|
Input data frame of stops returned from naptan functions. |
required |
path |
str
|
Output path. e.g. '~/path/to/dir/naptan_stops.json' |
required |
create_map(df, disable_cluster_zoom=17)
Create a folium.Map object displaying the stops.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
pd.DataFrame
|
Input data frame of stops returned from naptan functions. |
required |
disable_cluster_zoom |
int
|
The zoom level at which point points are no longer clustered on the map, by default 17. |
17
|
Returns:
Type | Description |
---|---|
folium.Map
|
A folium.Map object that can be used interactively or embedded in a webpage. |
view_map(df, disable_cluster_zoom=17)
View the stops on a folium-generated map, in the browser.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
pd.DataFrame
|
Input data frame of stops returned from naptan functions. |
required |
disable_cluster_zoom |
int
|
The zoom level at which point points are no longer clustered on the map, by default 17. |
17
|