MANO MARKS: Hi, I'm Mano Marks.
I'm a developer advocate on the Google Maps API team.
This screencast takes a look at Autocomplete, which is a
part of the Google Maps API Places library.
Autocomplete allows you to do something simple.
As users type in input, you suggest results to them.
These results can be addresses, restaurants, cafes,
landmarks, cities, states, anything that is included in
our places library or our geocoding service.
So why would you use Autocomplete?
Autocomplete has two main uses.
One is for people who are not sure what they're actually
looking for.
So as they type in things that suggest things that sound
like, or look like what they're looking for, and are
architecturally relevant to the location that they're
looking at.
And the other is, if you are on a mobile device, you have
very few keystrokes to get to the result that you need.
Now if you've ever used a mobile phone, typed in
something, tried to get a result, you know that it can
be much more laborious than using the keyboard.
So Autocomplete helps you solve that issue.
Now, the Autocomplete API is part of our JavaScript API,
but we also have a web service that can be used in a variety
of formats on the server side or on a mobile device.
So I'll invite you to check that out, and there will be a
link to the documentation at the end of this video.
Let's take a look.
So this is a map of San Francisco.
And as I start typing in, you can see that it's starting to
give me results that are contextually
relevant to San Francisco.
I typed in T-E, and I get a variety of things in San
Francisco and Berkeley-- which is nearby--
that might match that query.
And as I click on one of them, I'm going to say look at the
Tenderloin.
Tenderloin's a neighborhood in San Francisco.
I click on the marker, and there's some additional
information.
With a few lines of code, I've added this powerful search to
my application.
I'll go ahead and close that window.
Now, say I were to go looking for pizza.
Pizza's the traditional demo of choice for maps.
I'm going to type in Z-A-C, and you'll see I get Zachary's
Chicago Pizza.
I'm doing this because Zachary's is a popular pizza
joint in the San Francisco Bay area, but it's in Oakland.
So I'm going to go over there, and we'll look at that.
Click there, and I've got some more information, and even a
link to the Google place page for Zachary's Chicago Pizza.
Now if I were to take a look again, and start typing in
T-E, you might notice that the results are actually different
than they were for when I was in San Francisco.
Now, the application hasn't changed.
The only thing that's changed is that the map has changed
focus to Oakland instead of San Francisco, and you'll see
I get contextually relevant results to Oakland.
I can also search directly for addresses.
So, say I wanted to type in 1-6-0-0 A-M. I get 1600
Amphitheatre Parkway, Mountain View, California--
it's Google's address.
You can see here that this is a very powerful tool that
allows your users to interact directly with our places and
geocoding services without you having to write more than a
few lines of code.
And then once that result is returned to your application,
you can display it on the map, or you can pull up additional
information about it if we have it in our places library.
The last feature I want to mention is that you can
restrict the results returned to either a
establishment or a geocode.
So if you do want to just have an address search, or just
have something that searches for businesses on your map,
then you can certainly do that as well.
So that's Autocomplete.
A few lines of code, you're up and running in no time.
Take a look at the documentation.
You can click on this link in the video, and it'll take you
right there.