The free mapping service by Google that gives you various types of geographical information we call as Google Maps. To use this mapping service on your website, you use an API given by Google. Here you will learn how to use the API and use the mapping service.
Code for creating Google Maps
First thing is to become familiar with JavaScript. If you know a little of HTML, it will help. Here is the code that will make a map for you.
<!DOCTYPE html>
<html>
<body>
<h1>My First Google Map</h1>
<div id="googleMap" style="width:100%;height:400px;"></div>
<script>
function myMap() {
var mapProp= {
center:new google.maps.LatLng(8.91011,12.1314), zoom:5,
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&callback=myMap"></script>
</body>
</html>
There are tons of things you can do with maps. From presenting a location to discovering the routes, the map proves useful for the user. iOS was using Google Mobile Maps for all its needs until recently. But, things changed and Apple began to use the Map Kit for its mapping services. Ever since Apple stopped using the Google Maps, Google decided to use its own Maps SDK for all platforms including iOS. This then is the strong contender for all map SDKs used on every platform. This is why writing Google Maps SDK for iOS is definitely worth it.
Always Suggest To Read : Consider this 10 Common App Rejection Reasons
You need to get the API Key if you want to use the Google maps in your project. This consists of a special string of code that you get from Google which you can use within your app to call the maps function. This you do by fetching it from the special place for Mobile App developers known as Google Developers Console. You need a Google account to operate from this place.
Using your Google account, sign in to the Google Developers Console and click to the API Project Option. Next expand by clicking on APIs & auth menu. You need to find out the Google Maps SDK for iOS and so go through the list presented to you. Click on the correct tab and you will go to the page where you can enable the API. After that, click on Credentials options under the APIs and auth menu.
In the new page, click on Create new Key button. This will be on the bottom left side. Once you click the button, a dialog window will open asking you what type of key you want to create. Inside this box, you have many options shown such as Server key, Browser key, Android key, and iOS key. In the next window, you can type or paste the bundle identifier of your app. You can copy the value of the com.appcoda.GMapsDemo and this step makes our app authorised to use the Google Maps API.
Once you click on the Create button, you create the API. If you want to add or remove the app bundle IDs you click on the Edit Allowed iOS Applications button.