15
Working with Google Maps Javascript, XML, and AJAX By: James McAndrew http:// RidgeAveTech.blogspot.com

A Brief Introduction to the Google Maps API

  • Upload
    jimmy

  • View
    1.270

  • Download
    1

Embed Size (px)

DESCRIPTION

A very brief introduction to how to use the Google Maps API

Citation preview

Page 1: A Brief Introduction to the Google Maps API

"

Working with Google Maps Javascript, XML, and AJAX

By: James McAndrew http://RidgeAveTech.blogspot.com

Page 2: A Brief Introduction to the Google Maps API

What is Google Maps?

  Google Maps is a free web mapping service.

  It offers street level maps for pedestrians, cars, and public transportation.

  It also shows terrain and photographic information.

  It has a very extendable API (Application Programming Interface) that can be used to develop custom Google Maps based applications.

Page 3: A Brief Introduction to the Google Maps API

How can developers use Google Maps API?

  Google Maps “Mashups” have been popular for quite some time. Some examples of these are:   http://www.mapskrieg.com/view/ - A Craigslist Apartment

finder / Google Maps mashup

  http://geotwitter.org/ - A map of recent posts on the website Twitter.

  Many more examples can be found here: http://mashable.com/2008/05/14/17-google-maps-mashups-to-waste-away-your-day/ and all over the web

Page 4: A Brief Introduction to the Google Maps API

This Slide Show

  This Slide show was created to demonstrate the basic concepts behind adding markers to a Google Maps document.

  This Slide show will not cover Javascript programming or customization of Google Maps applications.

  It is intended to give users a better understanding of how these mashups are created.

  Developers may want to use the example code to extend their own maps. There are links at the end of the presentation to the full developers site.

Page 5: A Brief Introduction to the Google Maps API

HTML

  HyperText Markup Language.

  The language of the World Wide Web

  Example: <HTML>

<HEAD>

<TITLE>Webpage</TITLE> </HEAD>

<BODY> Content

<BODY> </HTML>

Page 6: A Brief Introduction to the Google Maps API

Javascript

  Javascript is a client side scripting language.

  It is generally run within the user’s Web Browser.

  Very similar to both C and Java, but is a distinct language with its own syntax.

  Many dynamic websites are driven by Javascript. (e.g. Google Maps)

Page 7: A Brief Introduction to the Google Maps API

XML

  eXtensible Markup Language

  Similar to HTML

  Used to store information.

  Example: <recipe name=“Cracker” prep_time="5 mins" cook_time="3 hours">

<title>Basic bread</title> <ingredient amount=“1” unit=“cup”>Flour</ingredient>

<ingredient amount=“1” unit=“cup”>Water</ingredient> <instructions>

<step>Mix ingredients together.</step> <step>Bake in the oven at 180°C for 30 minutes.</step>

</instructions> </recipe>

Page 8: A Brief Introduction to the Google Maps API

AJAX

  Asynchronous JavaScript and XML

  Used to dynamically load XML information into a HTML window using JavaScript.

  Ajax is not a programming language, the term is used to describe the use of XMLHttpRequest or similar objects.

Page 9: A Brief Introduction to the Google Maps API

XMLHttpRequest

  XMLHttpRequest is the main object we use in JavaScript to load an XML document.

  Google Maps provides an interface to load XML that uses XMLHttpRequest, but does not require the programmer to directly manipulate the XMLHttpRequest object.

Page 10: A Brief Introduction to the Google Maps API

Google Maps API

  Google created the Google Maps API to facilitate developers integrating Google Maps into their web sites with their own data points. It is a free service, which currently does not contain ads, but Google states in their terms of use that they reserve the right to display ads in the future.

  By using the Google Maps API it is possible to embed the full Google Maps on an external web site. Developers are required to request an API Key, which is bound to the web site and directory entered when creating the key. Creating your own map interface involves adding the Google JavaScript code to your page, and then using Javascript functions to add points to the map.

  (From Wikipedia)

Page 11: A Brief Introduction to the Google Maps API

Requesting a Google Maps API Key

  http://code.google.com/apis/maps/signup.html

  Requires a web server to run your object.

Page 12: A Brief Introduction to the Google Maps API

Creating your XML Document

<markers>

<marker name="Placemark 1" lat="40.191037" lng="-75.199484" note=”Lansdale, PA" />

<marker name="Placemark 2" lat="40" lng="-75" note="Riverside, NJ" />

</markers>

Page 13: A Brief Introduction to the Google Maps API

Google M

aps HT

ML

P

age 1

Page 14: A Brief Introduction to the Google Maps API

Google M

aps HT

ML

P

age 2

Page 15: A Brief Introduction to the Google Maps API

More information:

  Google’s API How-To   http://code.google.com/apis/maps/

  Google Maps API Blog   http://googlemapsapi.blogspot.com/

  My Example:   http://notquitesuremusic.com/maps/CD.html