Difference between Google's Query and Place Autocomplete? - google-maps

Whats the difference between these two services: Google Place Autocomplete https://developers.google.com/places/web-service/autocomplete and Google Query autocomplete https://developers.google.com/places/web-service/query
Except theirs descriptions, which are not clear enough.

The difference between these web services is the following:
The Place autocomplete service will return as suggestions only places from Google database. These place predictions have a place ID, so you can resolve them to position on the map.
The Query autocomplete service will return as suggestions both places from Google database and geographic query predictions. The geographic query predictions are not places entities, they don't have place ID, they are search texts like "pizza near Sydney, New South Wales, Australia" that you probably need to pass further to search engine of your app.

Related

With the Google API is there anyway to get all of the cities in a state, and all of the towns in a city?

I am trying to build an application where a user can "drill-down" so to speak to find a location. So if they click on "US" it should show all of the states, and if they click a state it should show all of the cities. I have looked at the Google Places API, and I'm not exactly sure what the best method is. I thought about using bounds but I feared it would not be accurate because bounds works off of a rectangle. Not the actual city or state.
There is no any Google Maps API that can return a list of cities in the state. The Google APIs does not work this way, they are not like a database search.
You can try a Places API autocomplete, but this API returns up to 5 suggestions when you are typing a text. You cannot define a strict filter by city or state, you can only bias result to certain view port.

Google Map API for addesses search

I have been searching for some information on what I want to achieve but not getting any clear answers.
I have a database with thousands of addresses. I want that when the user searches by entering a postcode, the search should show all the available addresses close to the postcode in a map. Zooming In would obviously show closer address to the search postcode (and hence less search results) and zooming out would also include farther addresses (and hence more search results). And then clicking the location icon would display the complete address.
Do I need to store the addresses as longitude and latitude or google map can search a location using postcode? If I need to store the longitude and latitude then whats the best way to convert an address to long and lat?
I really appreciate if you can point me to any useful links or reusable code.
Thanks
As I understand it, you want to find all closest locations from YOUR data to some location, which is identified by a postcode.
First, you have to convert all your addresses to coordinates (Latitude and Longitude). You can do that using Google Geocode API, you will have to create as script, which calls Google Geocode API for every single address in your db:
https://maps.googleapis.com/maps/api/geocode/json?address=EXAMPLE_ADDRES&key=YOUR_API_KEY
The response this script brings you is documented here. You can parse it to get latitude and longitude for each locations and store them in your database. BEWARE of limitations of the Google Geocode API. They are listed here. You have to create your script in a way that won't exceed those limits. Also read this article for caching the results of geocoding, to make sure you don't violate the terms of service. The article also contains some best practices and examples of server side geocoding.
Now, when somebody inputs postcode to your application, you can use the geocoding API or Google maps Geocoding service to translate postcode to coordinate and using haversine formula you can calculate the closest locations from your db, to coordinates of the postcode location. You can do that on frontend side, example in this SO answer (instead of address you will input postcode + state/country in the address bar) or on backend side, if you use MySQL check this SO question.

How can I get same search result as google map

When I am searching "Rudy barber Shop, New York" string in http://maps.google.com, google map showing 10 results...
But When I am using google map api in my App, It only returning two results
http://maps.googleapis.com/maps/api/geocode/xml?address=Rudy%20barber%20Shop,%20New%20York&sensor=false
Now my question is that how can get the same result.
Thanks
Mandeepd
I don't think you can get exactly the same results as in Google Maps.
Google Maps is a whole application. It uses multiple kinds of search engines behind the scenes and some may not be available as APIs, e.g. transit (public transport) directions.
Your sample request shows that you are using The Google Geocoding API which is meant for converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates. This only works for addresses, not businesses. When you put a business name in front of the address, the Geocoding API still tries to figure out where that may be, based on the part of your query that looks like an address. However, the Geocoding API is not meant for that use.
If you are after searching businesses around a given location, maybe you could use the The Google Places API (Experimental) but make sure to comply with its Requirements.

How to create search like maps.google.com

If we go to maps.google.com. and search "Nepal", it will search "Nepal"
If we seach "McDonalds", it shows restaurants in the current map boundaries.
If we search on map with Geocoder, but Geocoder will not show results in case of "McDonalds" or "KFC" etc.
If we use place library, the this cant search Cities, states, countries.
How can I implement that search? In my application.
Take the user keywords and pass them to geocoder.If no results are returned from geocoder then pass them to places api.
I think that's what google also does.
Cheers
You can use the Google Places Library. Places can take both geographic locations, including address, and establishments (landmarks, business, government offices, etc.). It also provides you with an autocomplete API as well. There is also a Places API web service that you can use directly from your server.
And this is the example of Autocomplete
http://docs.jquery.com/Plugins/Autocomplete

google map API, if possible to search nearby business hot spot?

all, which google map API could be use for search nearby business spot information like ATM/Branch (address and coordinates information etc)
thanks for help
This service is provided by Google as part of their Places API. As of today, it is only a developer preview, and you must have an Adsense account to register.
A search request will return up to 20 establishments, which indicate their type, so they can be filtered. There seems to be no way to perform a more direct search by type for now.