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

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

问题描述

当访问 http://maps.google.com 时,他们能够在搜索字段中输入查询并接收基于地点或地点,而不是硬搜索结果,就像在普通的 Google 搜索查询中那样.出于显而易见的原因,它们是一种适合地图界面的独特风格的结果(地名、位置).

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.

我已经研究了地图和标准 Google 搜索 API 几个小时了,并且对这个问题进行了多次搜索,但似乎找不到答案.

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.

基本上我想要做的是允许用户输入地址、地名或城市或州名或邮政编码,或者基本上是地图上允许的任何其他类型的位置,以及地理编码它.我觉得很愚蠢,因为这似乎必须存在,但我在 API 中看到的任何内容似乎都没有做到这一点.

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.

我不一定需要 AJAX 建议的结果.只是一种让用户输入一个好的名称并从中进行地理编码的方法,尽管用户输入的结果将是理想的.

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.

我在这里遗漏了什么?

推荐答案

您正在寻找的是来自 google maps 的 Geocoding API.

What you are looking is Geocoding API from google maps.

在此处查找文档

更新 5/12/2011

Google 刚刚开放了对其 Places API 的公开访问.这更符合原始问题请求的核心:

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

https://developers.google.com/maps/documentation/places/web-service/autocomplete

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

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