Intro to Google Maps Platform

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi, my name is Angela Yu, and this is an introduction to Google Maps Platform. This video is intended for use by anyone interested in preparing for their future careers. In the next few minutes, we're going to discuss how you can bring the power of Google Maps into your applications. Many of you have probably already used Google Maps either to look up a place or to get directions in a web browser or on your mobile phone. As a developer building your own projects, you might've thought about use cases where it would be helpful to know where the user is, find what is nearby, or show where to find places or objects that your app makes available. When you incorporate location-based data into your app, you leverage all the investment that Google puts into making that great experience you have with the Google Maps apps and bring that richness into your app. Let me break down what it takes to make the Google Maps experience you see today. At Google, we've been mapping the world since 2005. Since then, we've invested heavily in mapping the ever-changing world from providing street addresses for the first time to residents of India, to displaying imagery from the depths of the oceans to Mars, and even Pluto's moon. That's how we get the coverage number you see here. So if you want your app to work anywhere your users might be in the world, Google Maps Platform is likely to have that area covered. On top of that, we invest a lot in improving the accuracy and freshness of our data. Since launching Google Maps, we've expanded our Street View vehicles to 88 countries, built advanced machine learning capabilities, and created our Local Guides program all to increase how quickly we can keep up with the changing world around us. When we decided to make all this data available to developers for use in other apps, we grouped them into three core API families: Maps brings the real world to your users with customizable maps and Street View imagery; Places helps users discover the world with rich metadata for over 150 million places, and enables them to find specific places using phone numbers, addresses and real-time signals; Routes helps your users find the best way to get from A to Z with comprehensive data and real-time traffic. That was an overview of our APIs, so let's try them out now. Let's start with the Maps APIs. The Maps JavaScript API is our most used API because web developers use it to build custom maps in their websites and web applications. The Embed API and Static API provide easier ways to get our maps into your website. Street View API makes a 360-degree imagery that we've captured available to your app. Mobile SDKs provide Android and iOS-specific functions for displaying Maps in your mobile apps. Now, I'll show you some sample code that would be used by a web developer to add a map to a web page. JavaScript is the most commonly used language in web development, so I'll use simple JavaScript inside the HTML code that is used for the skeleton of the page. This line is the first line you'll need to add, which will ensure that the rest of your JavaScript code calls the Maps JavaScript API. You'll see here that you need to create an API key and paste it in here. Every project has its own unique API key to identify which project is using the API. See these two videos for instructions on how to enable Google Maps Platform APIs and generate an API key for your project. At the end of the line, there's a <i>callback</i> which identifies which function in this page's code to call when the JavaSript API has responded. We're keeping the code structure really simple here. So all of the HTML, CSS and JavaScript code is in one file. You'll find the <i>initMap</i> function defined right here inside the <i>script</i> tag. What you see inside <i>initMap</i> is that we create a <i>google.maps.Map</i> object called <i>map</i> and then attach it to the HTML element with <i>id="map"</i>. Then I just open my HTML file in a web browser and, ta-da, I can see a map on my web page. That's just the beginning. You can fully customize this map, such as turning on and off visibility of various features; choosing different colors, like if you want your map to have a Dark mode; add markers and shapes that can be custom graphics or animated like any other element; and add Data layers to display static or live data, like this map showing the live feed of recent earthquakes and their magnitudes. That covers Maps. Now let's see what you can get from the Places APIs. With the main Places API, you can provide users data on location names, addresses, ratings, reviews, and contact information. Our community of 60 million local guides makes more than 20 million contributions per day in our efforts to provide accurate, reliable information. We also have the Time Zone API, Geocoding API, and Geolocation API to give developers access to more information about specific coordinates on the globe. Finally, the Places Library for the Maps JavaScipt API brings Places data into your web maps, and the SDKs for Android and iOS bring Places data into your mobile apps. So let's take a look at how that looks in code. Last time, we used the JavaScript API to show how web developers would use our APIs. This time, I'll show you our web services APIs so that no matter what language you're using, if you know how to call a REST API, you can get a data response and use it in your app however you want. I'm going to use Postman, which is a language-independent tool I use for organizing my REST API requests and testing for responses. But you can use your favorite method or tool for testing API requests. In Postman, I'll create a new request. The most important field here is where it says enter request URL. I'll get a sample web service URL from one of the Places APIs called the Geocoding API, which takes an address or a pair of latitude, longitude coordinates and returns the opposite. Paste that URL into the Postman field and you'll see that any parameters can be edited, either in the URL or in the Params fields below. This sample uses the address of Google's headquarters. We'll use this Geocoding API to request the latitude and longitude that corresponds to this exact address. Just like before, I need to have an API key from my Google Cloud project and paste that in here. I click Send and down below, I can see the JSON response that was returned. I could've also asked for an XML response if that worked better for my project. The JSON includes the full address, since I probably only typed part of the address, in a couple of formats. And also, here in the geometry section is a <i>location</i> object with a latitude and a longitude. So you can see, all I need is to customize the request URL up here with two parameters, address and API key, to get a lot of data back. Look here toward the bottom, there's a property called place ID-- that's a unique ID that Google Maps Platform assigned to this place. So let's use the Place Details API to learn more about it. I go to the Place Details documentation and grab the request URL. It says here that output should be replaced by either JSON or XML and there are two required parameters: place ID and key. I place that URL into Postman, change "output" to "json" and replace "parameters" with the two required fields. I'll copy the key from my Geocoding request, but I'm going to use a more interesting place ID to show you the rich data we get back from the Place Details API. And you can see, as I change the values in the Params, it updates the URL up top. Hit Send and let's look at the response to find out what's one of my favorite places in the world. Ah, it's in Maui. A placed called Ululani's Hawaiian Shave Ice. Not only do we get its name and address, but we also get its opening hours, pointers to photos of the place that I can display, its current rating, and some reviews. Now I can choose what information I'd want to display in my app, and I have the flexibility to pick and choose which of these fields I want to show. Finally, we have the Routes APIs. Directions API provides directions for driving, biking, or walking, and for public transit in more than 3.8 million stations and 20,000 towns and cities. Not only do you get the same directions that are trusted by users of the Google Maps app, but you also get travel times and live traffic data. You can probably guess what the Directions API looks like, where you provide an origin, up to 25 optional waypoints, a destination, and your API key. Now, let's take a look at the Distance Matrix API. This is something I was really impressed by when I learned about it. It's great if you have more complex use cases than a single origin to a single destination. Remember how I said the Directions API takes just one origin and one destination? Imagine you've got a bunch of people in various locations and you need to figure out the optimal combination to match each of those people with an assignment in another location. Normally, it would be pretty complicated to calculate the distance between each person and their possible assignments, and then compare all of those assignments and figure out which is the most efficient permutation overall. Thankfully, the Distance Matrix API takes multiple origins and multiple destinations and gives you the travel times and distances for all combinations. With a single API call, you can get all the data you need to make your assignment decisions to optimize for distance or travel time. I'm going to show you a neat trick in our documentation that will save you time when looking up your API key. The Distance Matrix API page has a sample request right here. I scroll to the end where it says <i>YOUR_API_KEY,</i> and I click on those words. It brings up this Google Cloud Platform project chooser and when I pick the project, it lets me choose which API key I want to use, and puts it right into the sample request on the Documentation page. Now, I can use the copy button and paste the whole request into my code or into Postman. I don't have to type anything and the sample request runs as is. You can see I only have one origin and one destination in this request, but the API is designed for you to provide multiple origins and multiple destinations as I described earlier. Finally, the Roads API helps you snap points that may have imprecise GPS coordinates to real roads nearby. We're always pushing the platform forward, so when you build with our APIs, you can know that we'll be expanding them so your apps can do more. One example of a new area for us is game developers-- providing our data to allow developers to bring the real world into their games, such as having realistic quests around the Eiffel Tower. And the other way around, allowing developers to bring their games into the real world with our Playable Locations API, so that players can bring their mobile devices to a playable location and encounter game characters, like this big green monster in Time Square. I hope that gave you some inspiration for ways you'd like to incorporate location-aware information into your own apps. To get started with Google Maps Platform, visit the links in the description below. Thanks for watching, and happy mapping. ♪ [outro music] ♪
Info
Channel: Google Maps Platform
Views: 68,940
Rating: undefined out of 5
Keywords: GDS: Yes, Introduction to Google Maps Platform, intro to Google Maps Platform, Google Maps Platform 101, intro to Google Maps, new in maps, new in Google Maps, Google Maps and your app, what is available on Google Maps, Google Maps Platform APIs, Google Maps Platform SDKs, SDKs, sample code, Maps APIs, Places APIs, Geocoding, Geolocation, Time Zone, Routes APIs, Directions, Distance Matrix, GMP, Google Maps Platform, angela yu, new developers, APIs, maps api, streetview api
Id: kA679ERgBV4
Channel Id: undefined
Length: 12min 8sec (728 seconds)
Published: Mon Sep 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.