pyemtmad.api.geo module

This file contains the endpoints for geo services.

See http://opendata.emtmadrid.es/Servicios-web/GEO

class pyemtmad.api.geo.GeoApi(wrapper)

Bases: object

Metaclass that contains the API methods for the geo endpoints.

get_arrive_stop(**kwargs)

Obtain bus arrival info in target stop.

Parameters:
  • stop_number (int) – Stop number to query.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Arrival]), or message string in case of error.

get_groups(**kwargs)

Obtain line types and details.

Parameters:lang (str) – Language code (es or en).
Returns:Status boolean and parsed response (list[GeoGroupItem]), or message string in case of error.
get_info_line(**kwargs)

Obtain basic information on a bus line on a given date.

Parameters:
  • day (int) – Day of the month in format DD. The number is automatically padded if it only has one digit.
  • month (int) – Month number in format MM. The number is automatically padded if it only has one digit.
  • year (int) – Year number in format YYYY.
  • lines (list[int] | int) – Lines to query, may be empty to get all the lines.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Line]), or message string in case of error.

get_info_line_extended(**kwargs)

Obtain extended information on a bus line on a given date.

Parameters:
  • day (int) – Day of the month in format DD. The number is automatically padded if it only has one digit.
  • month (int) – Month number in format MM. The number is automatically padded if it only has one digit.
  • year (int) – Year number in format YYYY.
  • lines (list[int] | int) – Lines to query, may be empty to get all the lines.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Line]), or message string in case of error.

get_poi(**kwargs)

Obtain a list of POI in the given radius.

Parameters:
  • latitude (double) – Latitude in decimal degrees.
  • longitude (double) – Longitude in decimal degrees.
  • types (list[int] | int) – POI IDs (or empty list to get all).
  • radius (int) – Radius (in meters) of the search.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Poi]), or message string in case of error.

get_poi_types(**kwargs)

Obtain POI types.

Parameters:lang (str) – Language code (es or en).
Returns:Status boolean and parsed response (list[PoiType]), or message string in case of error.
get_route_lines_route(**kwargs)

Obtain itinerary for one or more lines in the given date.

Parameters:
  • day (int) – Day of the month in format DD. The number is automatically padded if it only has one digit.
  • month (int) – Month number in format MM. The number is automatically padded if it only has one digit.
  • year (int) – Year number in format YYYY.
  • lines (list[int] | int) – Lines to query, may be empty to get all the lines.
Returns:

Status boolean and parsed response (list[RouteLinesItem]), or message string in case of error.

get_stops_from_stop(**kwargs)

Obtain a list of stops within the given radius of the specified stop.

Parameters:
  • stop_number (int) – Number of the stop to query.
  • radius (int) – Radius (in meters) of the search.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Stop]), or message string in case of error.

get_stops_from_xy(**kwargs)

Obtain a list of stops around the given point.

Parameters:
  • latitude (double) – Latitude in decimal degrees.
  • longitude (double) – Longitude in decimal degrees.
  • radius (int) – Radius (in meters) of the search.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Stop]), or message string in case of error.

get_stops_line(**kwargs)

Obtain information on the stops of the given lines.

Parameters:
  • lines (list[int] | int) – Lines to query, may be empty to get all the lines.
  • direction (str) – Optional, either forward or backward.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Stop]), or message string in case of error.

get_street(**kwargs)

Obtain a list of nodes related to a location within a given radius.

Not sure of its use, but…

Parameters:
  • street_name (str) – Name of the street to search.
  • street_number (int) – Street number to search.
  • radius (int) – Radius (in meters) of the search.
  • stops (int) – Number of the stop to search.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Site]), or message string in case of error.

get_street_from_xy(**kwargs)

Obtain a list of streets around the specified point.

Parameters:
  • latitude (double) – Latitude in decimal degrees.
  • longitude (double) – Longitude in decimal degrees.
  • radius (int) – Radius (in meters) of the search.
  • lang (str) – Language code (es or en).
Returns:

Status boolean and parsed response (list[Street]), or message string in case of error.