Skip to content

Instantly share code, notes, and snippets.

@sp3c73r2038
Created November 9, 2011 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sp3c73r2038/1350814 to your computer and use it in GitHub Desktop.
Save sp3c73r2038/1350814 to your computer and use it in GitHub Desktop.
Points of Interest Spec

Points of Interest

通过给出的地点或者坐标信息,查询周边区域的地理信息。

功能

  • 地理信息搜索,通过给定的关键字给出地理的标准名字和坐标。还提供给予坐标信息返回附近的地点等等。

  • 未来可能加入更多功能

API

服务名称:POI�

geocode(name, bounds)

参数

  • name(required) 搜索地理的关键字,必填

  • bounds(optional) 指定搜索的区域范围,以右上角(东北)和左下角(西南)2个点画成矩形

返回结果

返回结果里是一个数组,例如调用使用geocoding("正大广场", 30.77980120,120.83970670|31.66889670,122.11379890),将返回如下结果:

[
    {
        "name": "中国上海市浦东新区丰和路陆家嘴环路(正大广场) 邮政编码: 200121",
        "lat": 31.2375,
        "lng": 121.500512
    },
    {
        "name": "中国上海市浦东新区花园石桥路陆家嘴环路(正大广场)",
        "lat": 31.234822,
        "lng": 121.501158
    }
]

如果无结果将返回空数组。

place(lat, lng, radius)

参数

  • lat(required) latitude - 纬度,有效值范围是-90~90,-90表示南极,90表示北极

  • lng(required) longitude - 经度,有效值范围是-180-180,-1800表示西半球,0180表示东半球

  • radius(optional) 搜索半径 - 给定经纬度的搜索半径,最大支持50000,单位是米。如果不传,默认是500。

返回结果

返回结果是一个数组,例如调用place(31.2367, 121.501, 500),将返回如下:

[
    {
        "name": "上海海洋水族馆",
        "lat": 31.2406490,
        "lng": 121.5019440
    },
    {
        "name": "上海环球金融中心会议中心",
        "lat": 31.2399370,
        "lng": 121.4995940
    },
    {
        "name": "正大广场",
        "lat": 31.2366740,
        "lng": 121.4997340
    },
    ...
]

如果无结果将返回空数组。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment