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

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

问题描述

去年,谷歌在其产品中添加了搜索区域轮廓,正如在许多地方报道的那样,并且在谷歌地图上可见.例如.

Twitter 和其他大型组织是否正在使用单独的 API?是否添加了此功能,但尚未记录?还是我只是错过了公告而找不到任何文档?

解决方案

你在那里看到的大纲来自 twitter,他们肯定已经存储了它们.

看一下调用twitter-page时请求的json-file: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 已更改,示例不再有效(需要身份验证)

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天全站免登陆