Google Maps API是否提供了一种按名称搜索地点的方法? [英] Does Google Maps API offer a way to search for locations by name?

查看:140
本文介绍了Google Maps API是否提供了一种按名称搜索地点的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

访问 http://maps.google.com 时,他们可以在搜索字段中输入查询并获得基于结果的结果在地点或地点,而不是困难的搜索结果,就像在正常的Google搜索查询中一样。他们是一种独特的结果风格(地名,地点名称),出于显而易见的原因,它适合于地图界面。



我一直在挖掘地图和标准谷歌搜索API几个小时了,并且对这个问题进行了多次搜索,我似乎无法找到答案。



他们显然有本地搜索,但这已被弃用,并且只有在提供初始经纬度时才会产生结果。我希望能够找到没有初始经纬度的地方或位置。

基本上我想要做的是允许用户输入地址,地点名称或城市名称或州或邮编,或者基本上任何地图上允许的其他类型的位置,并对其进行地理编码。我觉得自己很愚蠢,因为这看起来好像就在那里,但我在API中看到的东西似乎都没有。



我不需要AJAX建议结果,必然。只是用户输入一个好名字和地理编码的方式,虽然用户类型的结果是理想的。



我在这里错过了什么?

解决方案

您正在寻找的是来自Google地图的Geocoding API。



在此处查找文档



UPDATE 5/12/2011



到他们的Places API。这更多的是原始问题请求的核心内容:

http://code.google.com/apis/maps/documentation/places/autocomplete.html


When one visits http://maps.google.com, they are able to type queries into the search field and receive results based on locations or places, and not hard search results, as they would in a normal Google Search query. They're a unique style of result (names of places, locations) suited to the Maps interface for obvious reasons.

I've been digging through both the Maps and standard Google Search API for a couple hours now, and have done multiple searches on this question, and I can't seem to find the answer.

They obviously have the Local Search, but that's been deprecated, and it only yields results if you provide an initial lat/long. I want to be able to find places or locations with no initial lat/long.

Essentially what I want to do is allow a user to type in an address, name of a place or name of a city or state or a zip code, or essentially any other kind of location that is allowable on Maps, and geocode it. I feel stupid because this seems like it has to be there, but nothing I've seen in the API seems to do this.

I don't need the AJAX suggested results, necessarily. Just a way for a user to type in a nice name and geocode from it, though results as a user types would be ideal.

What am I missing here?

解决方案

What you are looking is Geocoding API from google maps.

Find Documentation here

UPDATE 5/12/2011

Google just opened up public access to their Places API. This is more to the heart of the original question request:

http://code.google.com/apis/maps/documentation/places/autocomplete.html

这篇关于Google Maps API是否提供了一种按名称搜索地点的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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