Geofox. Core. Stations
(geofox_ex v0.1.1)
View Source
Station related functions for the Geofox API.
This module provides functions for finding stations, addresses, and points of interest, as well as retrieving detailed station information including accessibility features.
Summary
Functions
Search for stations, addresses, or points of interest by name.
Get detailed information about a station including elevators and accessibility features.
List all available stations.
Functions
@spec check_name(Geofox.Client.t(), Geofox.Types.sd_name(), keyword()) :: {:ok, map()} | {:error, term()}
Search for stations, addresses, or points of interest by name.
This function searches the system for locations that match the given name or partial name. It can find stations, addresses, POIs, and other searchable locations.
Parameters
client- The Geofox clientname- Location information ast:Types.sd_name/0containing at least a nameopts- Optional parameters
Options
:language- Language code (default: "de"):version- API version (default: 1):filter_type- Filter type (default: "NO_FILTER"):max_list- Maximum number of results to return:max_distance- Maximum distance for location searches in meters:coordinate_type- Coordinate system (default: "EPSG_4326"):tariff_details- Include tariff zone information (default: false):allow_type_switch- Allow switching between location types (default: true)
Examples
# Search for a station by name
name_info = %{name: "Hauptbahnhof", type: "STATION"}
{:ok, results} = Geofox.Core.Stations.check_name(client, name_info)
# Search with options
{:ok, results} = Geofox.Core.Stations.check_name(client, name_info,
max_list: 10,
tariff_details: true
)
# Search for addresses
address_info = %{name: "Mönckebergstraße 7", type: "ADDRESS"}
{:ok, results} = Geofox.Core.Stations.check_name(client, address_info)
@spec get_station_information(Geofox.Client.t(), Geofox.Types.sd_name(), keyword()) :: {:ok, map()} | {:error, term()}
Get detailed information about a station including elevators and accessibility features.
This function retrieves information about a station, including:
- Elevator status and specifications
- Platform layouts and accessibility
- Real-time elevator status updates
Parameters
client- The Geofox clientstation- Station information ast:Types.sd_name/0opts- Optional parameters
Options
:language- Language code (default: "de"):version- API version (default: 1):filter_type- Filter type (default: "NO_FILTER")
Examples
station = %{
id: "Master:1",
name: "Hauptbahnhof",
type: "STATION"
}
{:ok, info} = Geofox.Core.Stations.get_station_information(client, station)
# Access elevator information
partial_stations = info["partialStations"]
elevators = Enum.flat_map(partial_stations, & &1["elevators"])Returns
The response includes:
partialStations- List of station parts with their elevators and featureslastUpdate- Timestamp of the last information update- Elevator details including dimensions, status, and accessibility features
@spec list_stations( Geofox.Client.t(), keyword() ) :: {:ok, map()} | {:error, term()}
List all available stations.
This function retrieves a list of all stations in the system, optionally filtered by modification types and data release versions.
Parameters
client- The Geofox clientopts- Optional parameters
Options
:language- Language code (default: "de"):version- API version (default: 1):filter_type- Filter type (default: "NO_FILTER"):data_release_id- Data release ID to filter changes since a specific version:modification_types- List of modification types (e.g., ["MAIN", "POSITION"]):coordinate_type- Coordinate system (default: "EPSG_4326"):filter_equivalent- Filter equivalent stations (default: false)
Examples
# Get all stations
{:ok, stations} = Geofox.Core.Stations.list_stations(client)
# Get stations modified since a specific data release
{:ok, stations} = Geofox.Core.Stations.list_stations(client,
data_release_id: "2024-01-15",
modification_types: ["MAIN", "POSITION"]
)