SlideShare ist ein Scribd-Unternehmen logo
1 von 15
ADDING A GOOGLE MAP TO
YOUR WEBSITE
By
Rajeev Ranjan


Adding a Google Map to your web page is very easy, once
you've been shown how! That's what we're going to do in this
lesson - we'll go over each step of creating a basic Google
Map using the JavaScript API.
WHAT YOU'LL NEED


You don't need much to create a Google Maps API
webpage:



A text editor. Windows machines generally include Notepad;
Mac OS X comes with TextEdit; Linux machines come with a
variety of applications, including gedit, vim, or KWrite.



A web browser. We heart Google Chrome, but there are
many web browsers available for various platforms: Firefox,
Safari, and Internet Explorer are some of the best-known
options.
TRY IT OUT





The basic HTML page:Because everything on the web is made up of HTML, we'll
start there. The following code creates the simplest of web
pages:

None of this is specific to Google Maps - it's the basis for any
HTML page. Open your text editor and add this code, then
save the file to your desktop as google-maps.html (or any
other filename that ends with .html).


Your Google Map requires a page element in which to appear;
add a div tag to the body with an id attribute of map canvas.
This creates a container that we'll reference later in the
lesson.


Set the width and height of the div element using CSS. By default, a
div has a height of 0, meaning that any map you place inside it won't
be visible. Use a style tag in the head to set the map to any size; in
this case 500 pixels wide and 400 pixels high.


Load the HTML file in a web browser by dragging it from your
desktop into the address bar of your browser. You'll notice that
nothing is displayed - there's nothing in the div yet. If you'd like
to see the div on your page, add a background-color CSS
declaration to your existing <style> tag:



Reloading the page will display a grey box; that's your div.
To bring forth a map, you must add two pieces of JavaScript to
your page. The first loads the Google Maps JavaScript API;
the second creates and configures the map.


LOADING THE API


Load the Google Maps API by adding a <script> tag to the <head>
section of your HTML. This script downloads the code required to
display maps on your page.



Notice that the URL contains a sensor parameter, which is set to false. This
example does not use any GPS device or sensor to detect the user's
location; if you're using any sort of geolocation in your application, this must
be changed to true
CREATE AND CONFIGURE THE MAP


The final piece of code is the JavaScript that creates the map.
The code contains a function to run once the page has
loaded. In this example, and all of the examples in the Maps
API documentation, this function is named initialize.



Add this code immediately after the <script> tag you created
in the last step.
THE GOOGLE.MAPS.MAP OBJECT


The first thing the initialize function needs to do is create a
new Google Maps object:



The Map object constructor takes two arguments:








center is a Google Maps LatLng object that tells the the API where
to center the map.
zoom is a number between 0 (farthest) and 22 that sets the zoom
level of the map.
mapTypeId is used to specify what type of map to use. Your
choices are ROADMAP, SATELLITE, HYBRID, or TERRAIN.
EXECUTING THE JAVASCRIPT FUNCTION


Add an event listener to the window object that will call the
initialize function once the page has loaded. Calling initialize
before the page has finished loading will cause problems, since
the div it's looking for may not have been created yet; this
function waits until the HTML elements on the page have been
created before calling initialize.
THE FINISHED CODE


This is the final code you've put together in this lesson. It:



Creates a div, and gives it a size.



Loads the Google Maps JavaScript API v3.



Creates and displays a Google Map in the div.



Final Full code is in next slide….
Google Map Code
Google Map Code

Weitere ähnliche Inhalte

Was ist angesagt?

The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliTracy Lee
 
04 cloud computing sttp2020
04 cloud computing  sttp202004 cloud computing  sttp2020
04 cloud computing sttp2020Satoru Hoshiba
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsEmily Hurn
 
Angular2 + New Firebase in Action
Angular2 + New Firebase in ActionAngular2 + New Firebase in Action
Angular2 + New Firebase in ActionRuben Chavarri
 
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...Tracy Lee
 
Build your first android mobile app
Build your first android mobile appBuild your first android mobile app
Build your first android mobile appekipaco
 
Creating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignCreating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignTracy Lee
 
30 days GCP GDSC info session
30 days GCP GDSC info session30 days GCP GDSC info session
30 days GCP GDSC info sessionDomendra Sahu
 
Android App Development 20150409
Android App Development 20150409Android App Development 20150409
Android App Development 20150409Hideo Kadowaki
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsdavrous
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Codemotion
 
GAS Session
GAS SessionGAS Session
GAS SessionBVCOE
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko3D
 
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집AWSKRUG - AWS한국사용자모임
 
Optimizing and Deploying Angular
Optimizing and Deploying AngularOptimizing and Deploying Angular
Optimizing and Deploying AngularJohn Papa
 
Practicing AppDevKit in kata training
Practicing AppDevKit in kata trainingPracticing AppDevKit in kata training
Practicing AppDevKit in kata traininganistar sung
 
Application Craft Tutorial for Google Map
Application Craft Tutorial for Google MapApplication Craft Tutorial for Google Map
Application Craft Tutorial for Google MapBarton Hammond
 

Was ist angesagt? (20)

The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cli
 
04 cloud computing sttp2020
04 cloud computing  sttp202004 cloud computing  sttp2020
04 cloud computing sttp2020
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
 
Angular2 + New Firebase in Action
Angular2 + New Firebase in ActionAngular2 + New Firebase in Action
Angular2 + New Firebase in Action
 
Vue.js Component Tools
Vue.js Component ToolsVue.js Component Tools
Vue.js Component Tools
 
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...
AngularJS RTP Slides - Angular 2 Demo #ngtattoo with Angular CLI, Newest New ...
 
Build your first android mobile app
Build your first android mobile appBuild your first android mobile app
Build your first android mobile app
 
Creating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignCreating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material Design
 
30 days GCP GDSC info session
30 days GCP GDSC info session30 days GCP GDSC info session
30 days GCP GDSC info session
 
Android App Development 20150409
Android App Development 20150409Android App Development 20150409
Android App Development 20150409
 
Réaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.jsRéaliser un jeu cross plateformes avec WebGL et babylon.js
Réaliser un jeu cross plateformes avec WebGL et babylon.js
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
GAS Session
GAS SessionGAS Session
GAS Session
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집
App Sync, 모바일 개발을 위한 GraphQL as a Service - 트랙1, Community Day 2018 re:Invent 특집
 
Optimizing and Deploying Angular
Optimizing and Deploying AngularOptimizing and Deploying Angular
Optimizing and Deploying Angular
 
App script
App scriptApp script
App script
 
Practicing AppDevKit in kata training
Practicing AppDevKit in kata trainingPracticing AppDevKit in kata training
Practicing AppDevKit in kata training
 
Application Craft Tutorial for Google Map
Application Craft Tutorial for Google MapApplication Craft Tutorial for Google Map
Application Craft Tutorial for Google Map
 

Andere mochten auch

0010 la era_de_los_smart_devices
0010 la era_de_los_smart_devices0010 la era_de_los_smart_devices
0010 la era_de_los_smart_devicesGeneXus
 
Teacher Dashboard for Google Apps overview june 2011
Teacher Dashboard for Google Apps overview june 2011Teacher Dashboard for Google Apps overview june 2011
Teacher Dashboard for Google Apps overview june 2011Hapara
 
Nuclear power station(Components)
Nuclear power station(Components)Nuclear power station(Components)
Nuclear power station(Components)Parth Patel
 
Online dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure CampOnline dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure CampMichal Brys
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonAdnan Masood
 
crystal xcelsius and web services by dashboardcafe.com
crystal xcelsius and web services by dashboardcafe.comcrystal xcelsius and web services by dashboardcafe.com
crystal xcelsius and web services by dashboardcafe.comSigit Yunanto
 

Andere mochten auch (7)

0010 la era_de_los_smart_devices
0010 la era_de_los_smart_devices0010 la era_de_los_smart_devices
0010 la era_de_los_smart_devices
 
Teacher Dashboard for Google Apps overview june 2011
Teacher Dashboard for Google Apps overview june 2011Teacher Dashboard for Google Apps overview june 2011
Teacher Dashboard for Google Apps overview june 2011
 
Nuclear power station(Components)
Nuclear power station(Components)Nuclear power station(Components)
Nuclear power station(Components)
 
Online dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure CampOnline dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure Camp
 
Presentation on BI & HR Mgt
Presentation on BI & HR MgtPresentation on BI & HR Mgt
Presentation on BI & HR Mgt
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
crystal xcelsius and web services by dashboardcafe.com
crystal xcelsius and web services by dashboardcafe.comcrystal xcelsius and web services by dashboardcafe.com
crystal xcelsius and web services by dashboardcafe.com
 

Ähnlich wie Google Map Code

Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivityAhsanul Karim
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
Link your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfLink your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfBe Problem Solver
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptwesley chun
 
ArcGIS API for Javascript Tutorial
ArcGIS API for Javascript TutorialArcGIS API for Javascript Tutorial
ArcGIS API for Javascript TutorialMohammed Mahmoud
 
Android
AndroidAndroid
Androidscottw
 
Google Apps Script for Beginners- Amazing Things with Code
Google Apps Script for Beginners- Amazing Things with CodeGoogle Apps Script for Beginners- Amazing Things with Code
Google Apps Script for Beginners- Amazing Things with CodeLaurence Svekis ✔
 
What is Objective-j
What is Objective-jWhat is Objective-j
What is Objective-jJoe Terry
 
Everything about flutter web development
Everything about flutter web developmentEverything about flutter web development
Everything about flutter web developmentKaty Slemon
 
Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAELove Sharma
 
How to build and deploy app on Replit
How to build and deploy app on ReplitHow to build and deploy app on Replit
How to build and deploy app on Replitmatiasfund
 
Ez Community Gandbox.fr
Ez Community Gandbox.frEz Community Gandbox.fr
Ez Community Gandbox.frGilles Guirand
 
Tech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsTech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsAppsilon Data Science
 
Integrate Google Map SDK in iOS App
Integrate Google Map SDK in iOS AppIntegrate Google Map SDK in iOS App
Integrate Google Map SDK in iOS AppHitesh Kumar Singh
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine DevelopmentRon Reiter
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloudwesley chun
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Natalia Efimtseva
 

Ähnlich wie Google Map Code (20)

Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Link your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfLink your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdf
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Intro To Google Maps
Intro To Google MapsIntro To Google Maps
Intro To Google Maps
 
ArcGIS API for Javascript Tutorial
ArcGIS API for Javascript TutorialArcGIS API for Javascript Tutorial
ArcGIS API for Javascript Tutorial
 
Android
AndroidAndroid
Android
 
Google Apps Script for Beginners- Amazing Things with Code
Google Apps Script for Beginners- Amazing Things with CodeGoogle Apps Script for Beginners- Amazing Things with Code
Google Apps Script for Beginners- Amazing Things with Code
 
What is Objective-j
What is Objective-jWhat is Objective-j
What is Objective-j
 
Everything about flutter web development
Everything about flutter web developmentEverything about flutter web development
Everything about flutter web development
 
Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAE
 
How to build and deploy app on Replit
How to build and deploy app on ReplitHow to build and deploy app on Replit
How to build and deploy app on Replit
 
Ez Community Gandbox.fr
Ez Community Gandbox.frEz Community Gandbox.fr
Ez Community Gandbox.fr
 
@Ionic native/google-maps
@Ionic native/google-maps@Ionic native/google-maps
@Ionic native/google-maps
 
Tech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsTech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboards
 
Integrate Google Map SDK in iOS App
Integrate Google Map SDK in iOS AppIntegrate Google Map SDK in iOS App
Integrate Google Map SDK in iOS App
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine Development
 
Location Based Services Without the Cocoa
Location Based Services Without the CocoaLocation Based Services Without the Cocoa
Location Based Services Without the Cocoa
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloud
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
 

Kürzlich hochgeladen

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Google Map Code

  • 1. ADDING A GOOGLE MAP TO YOUR WEBSITE By Rajeev Ranjan
  • 2.  Adding a Google Map to your web page is very easy, once you've been shown how! That's what we're going to do in this lesson - we'll go over each step of creating a basic Google Map using the JavaScript API.
  • 3. WHAT YOU'LL NEED  You don't need much to create a Google Maps API webpage:  A text editor. Windows machines generally include Notepad; Mac OS X comes with TextEdit; Linux machines come with a variety of applications, including gedit, vim, or KWrite.  A web browser. We heart Google Chrome, but there are many web browsers available for various platforms: Firefox, Safari, and Internet Explorer are some of the best-known options.
  • 4. TRY IT OUT    The basic HTML page:Because everything on the web is made up of HTML, we'll start there. The following code creates the simplest of web pages: None of this is specific to Google Maps - it's the basis for any HTML page. Open your text editor and add this code, then save the file to your desktop as google-maps.html (or any other filename that ends with .html).
  • 5.  Your Google Map requires a page element in which to appear; add a div tag to the body with an id attribute of map canvas. This creates a container that we'll reference later in the lesson.
  • 6.  Set the width and height of the div element using CSS. By default, a div has a height of 0, meaning that any map you place inside it won't be visible. Use a style tag in the head to set the map to any size; in this case 500 pixels wide and 400 pixels high.
  • 7.  Load the HTML file in a web browser by dragging it from your desktop into the address bar of your browser. You'll notice that nothing is displayed - there's nothing in the div yet. If you'd like to see the div on your page, add a background-color CSS declaration to your existing <style> tag:  Reloading the page will display a grey box; that's your div. To bring forth a map, you must add two pieces of JavaScript to your page. The first loads the Google Maps JavaScript API; the second creates and configures the map. 
  • 8. LOADING THE API  Load the Google Maps API by adding a <script> tag to the <head> section of your HTML. This script downloads the code required to display maps on your page.  Notice that the URL contains a sensor parameter, which is set to false. This example does not use any GPS device or sensor to detect the user's location; if you're using any sort of geolocation in your application, this must be changed to true
  • 9. CREATE AND CONFIGURE THE MAP  The final piece of code is the JavaScript that creates the map. The code contains a function to run once the page has loaded. In this example, and all of the examples in the Maps API documentation, this function is named initialize.  Add this code immediately after the <script> tag you created in the last step.
  • 10. THE GOOGLE.MAPS.MAP OBJECT  The first thing the initialize function needs to do is create a new Google Maps object:  The Map object constructor takes two arguments: 
  • 11.    center is a Google Maps LatLng object that tells the the API where to center the map. zoom is a number between 0 (farthest) and 22 that sets the zoom level of the map. mapTypeId is used to specify what type of map to use. Your choices are ROADMAP, SATELLITE, HYBRID, or TERRAIN.
  • 12. EXECUTING THE JAVASCRIPT FUNCTION  Add an event listener to the window object that will call the initialize function once the page has loaded. Calling initialize before the page has finished loading will cause problems, since the div it's looking for may not have been created yet; this function waits until the HTML elements on the page have been created before calling initialize.
  • 13. THE FINISHED CODE  This is the final code you've put together in this lesson. It:  Creates a div, and gives it a size.  Loads the Google Maps JavaScript API v3.  Creates and displays a Google Map in the div.  Final Full code is in next slide….