开发者

Does Google Maps API offer a way to search for locations by name?

开发者 https://www.devze.com 2023-03-04 06:28 出处:网络
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 G开

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 G开发者_如何学编程oogle 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:

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


I think you're looking for the google.maps.Geocoder class:

A service for converting between an address and a LatLng.

0

精彩评论

暂无评论...
验证码 换一张
取 消