---
title: "get nearest stations · RUAL Documentation"
description: "Find the NS stations closest to a coordinate. Provide a geo point, or a separate latitude and longitude."
canonical: https://docs.rual.nl/block-types/NS/nsconnection_nearest_stations
language: en
---

# get nearest stations

This block is part of the [`NS`](https://docs.rual.nl/block-types/NS) group and was last modified in core [`v15.0.0`](https://docs.rual.nl/core-versions/150000).

Find the NS stations closest to a coordinate. Provide a geo point, or a separate latitude and longitude.

- flow `flow`

- Connection required `nsconnection` The NS connection.

- Geo point required `geo_point` The coordinate to search around. • Hidden when other fields are filled

- Latitude required `number` Latitude to search around (when not using a geo point). • Hidden when other fields are filled

- Longitude required `number` Longitude to search around (when not using a geo point). • Hidden when other fields are filled

- Limit `number` Maximum number of stations to return.

- flow `flow`

- Connection `nsconnection` The NS connection.

- Success `condition` True if the request succeeded.

- Stations `array` The nearest stations, ordered by distance, each with a distance field and a geo_point.

- Nearest station `object` The single closest station.

- Count `number` Number of stations returned.

- Error `value` Error message if the request failed.

| `dichtstbijzijnde station` |
| --- |
| `nearest station` |

A typical wiring for [get nearest stations](https://docs.rual.nl/block-types/NS/nsconnection_nearest_stations): [create](https://docs.rual.nl/block-types/geopoint/geo_point_lat_lng_to_point) feeds the `geo_point` pin; [open connection](https://docs.rual.nl/block-types/NS/nsconnection_open) feeds the `flow` pin; [number](https://docs.rual.nl/block-types/number/number_default) feeds the `latitude` pin; [open connection](https://docs.rual.nl/block-types/NS/nsconnection_open) feeds the `connection` pin; [number](https://docs.rual.nl/block-types/number/number_default) feeds the `longitude` pin; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%20ui/state_debug).

![Studio canvas example for the get nearest stations block: typical wiring for get nearest stations.](https://docs.rual.nl/canvas-examples/nsconnection_nearest_stations.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [create](https://docs.rual.nl/block-types/geopoint/geo_point_lat_lng_to_point): feeds into this block. Generates a geo point based on the given latitude and longitude.

- [open connection](https://docs.rual.nl/block-types/NS/nsconnection_open): feeds into this block. Open a connection with the NS (Nederlandse Spoorwegen) Reisinformatie API. Reuse the resulting connection in the other NS blocks.

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

### Version history

Introduced in [`v15.0.0`](https://docs.rual.nl/core-versions/150000).
