bing_map

Module Contents

Classes

BINGMap

BING Map plugin for looking up map information.

AsyncBINGMap

BING Map plugin for looking up map information.

class lagent.actions.bing_map.BINGMap(key=None, description=None, parser=JsonParser)

Bases: lagent.actions.base_action.BaseAction

BING Map plugin for looking up map information.

参数:
key
base_url = 'http://dev.virtualearth.net/REST/V1/'
get_distance(start, end)

Get the distance between two locations in km.

参数:
  • start (str) – The start location

  • end (str) – The end location

返回:

distance information
  • distance (str): the distance in km.

返回类型:

dict

get_route(start, end)

Get the route between two locations in km.

参数:
  • start (str) – The start location

  • end (str) – The end location

返回:

route information
  • route (list): the route, a list of actions.

返回类型:

dict

get_coordinates(location)

Get the coordinates of a location.

参数:

location (str) – the location need to get coordinates.

返回:

coordinates information
  • latitude (float): the latitude of the location.

  • longitude (float): the longitude of the location.

返回类型:

dict

search_nearby(search_term, places='unknown', latitude=0.0, longitude=0.0, radius=5000)

Search for places nearby a location, within a given radius, and return the results into a list. You can use either the places name or the latitude and longitude.

参数:
  • search_term (str) – the place name.

  • places (str) – the name of the location. Defaults to 'unknown'.

  • latitude (float) – the latitude of the location. Defaults to 0.0.

  • longitude (float) – the longitude of the location. Defaults to 0.0.

  • radius (int) – radius in meters. Defaults to 5000.

返回:

places information
  • places (list): the list of places, each place is a dict with name and address, at most 5 places.

返回类型:

dict

class lagent.actions.bing_map.AsyncBINGMap(key=None, description=None, parser=JsonParser)

Bases: lagent.actions.base_action.AsyncActionMixin, BINGMap

BING Map plugin for looking up map information.

参数:
async get_distance(start, end)

Get the distance between two locations in km.

参数:
  • start (str) – The start location

  • end (str) – The end location

返回:

distance information
  • distance (str): the distance in km.

返回类型:

dict

async get_route(start, end)

Get the route between two locations in km.

参数:
  • start (str) – The start location

  • end (str) – The end location

返回:

route information
  • route (list): the route, a list of actions.

返回类型:

dict

async get_coordinates(location)

Get the coordinates of a location.

参数:

location (str) – the location need to get coordinates.

返回:

coordinates information
  • latitude (float): the latitude of the location.

  • longitude (float): the longitude of the location.

返回类型:

dict

async search_nearby(search_term, places='unknown', latitude=0.0, longitude=0.0, radius=5000)

Search for places nearby a location, within a given radius, and return the results into a list. You can use either the places name or the latitude and longitude.

参数:
  • search_term (str) – the place name.

  • places (str) – the name of the location. Defaults to 'unknown'.

  • latitude (float) – the latitude of the location. Defaults to 0.0.

  • longitude (float) – the longitude of the location. Defaults to 0.0.

  • radius (int) – radius in meters. Defaults to 5000.

返回:

places information
  • places (list): the list of places, each place is a dict with name and address, at most 5 places.

返回类型:

dict