添加“搜索区域”大纲谷歌地图结果 [英] Add "Search Area" outline onto google maps result

查看:148
本文介绍了添加“搜索区域”大纲谷歌地图结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

去年,谷歌在许多地方报道了搜索区域的外观,并在Google地图上显示。例如上。



Twitter和其他大型组织正在使用API​​ API吗?是否添加了此功能,但尚未记录?或者我只是错过了公告,找不到任何文档? 解决方案

您看到的轮廓来自twitter,必须存储它们。



查看您在调用Twitter页面时请求的json文件:
http://api.twitter.com/1/geo/id/c3f37afa9efcf94b.json



我试过了, geometry.coordinates [0] [0] 定义了一个很好的多边形)。

当您尝试它时,请注意该对的顺序是 lng,lat 不是 lat,lng



所以 twitter-geo-API 可能是实现大纲的良好开端,幸运的是twitter支持JSONP用于客户端解决方案。



查看示例: http://jsfiddle.net/doktormolle/MRYm3/




twitter-API已更改, (不需要验证)




< / edit>


Last year, Google added search area outlines to its offerings as reported in many places, and visible on Google maps itself. For example here, and reported here and here.

To be explicit, this is when google adds an outline relating to the search query. If you were to search for a town, a post code, or a zip code, Google will highlight this region of the map. Example:

This was apparently not available via the API, and only through Google's own web properties.

Recently, I noticed some other domains using this functionality, for example on Twitter.

Is there a seperate API Twitter and other large organisations are using? Has this functionality been added, but is as yet undocumented? Or have I simply missed the announcement and can't find any docs?

解决方案

The outlines you see there come from twitter, they must have stored them.

Take a look at the json-file that is requested when you call the twitter-page: http://api.twitter.com/1/geo/id/c3f37afa9efcf94b.json

I've tried it, geometry.coordinates[0][0] defines a fine polygon(guess the outline for Austin).

When you try it, notice that the order of the pair is lng,lat not lat,lng

So the twitter-geo-API may be a good start for implementing the outlines, fortunately twitter supports JSONP for a clientside solution.

See an example: http://jsfiddle.net/doktormolle/MRYm3/

<edit>

the twitter-API has been changed, the example didn't work anymore(authentication is required)

</edit>

这篇关于添加“搜索区域”大纲谷歌地图结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆