adding google maps to your college website l.
Skip this Video
Loading SlideShow in 5 Seconds..
Adding Google Maps to Your College Website PowerPoint Presentation
Download Presentation
Adding Google Maps to Your College Website

Loading in 2 Seconds...

play fullscreen
1 / 32

Adding Google Maps to Your College Website - PowerPoint PPT Presentation

  • Uploaded on

Adding Google Maps to Your College Website Paul Dempsey Director of Electronic Communication Dickinson College Introduction and Overview Session goals College maps and directions Maps on the web Google Maps Introduced February 2005 New type of web map

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Adding Google Maps to Your College Website' - jaden

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
adding google maps to your college website

Adding Google Maps to YourCollege Website

Paul Dempsey

Director of Electronic Communication

Dickinson College

introduction and overview
Introductionand Overview
  • Session goals
  • College maps and directions
  • Maps on the web
google maps
Google Maps
  • Introduced February 2005
  • New type of web map
  • Innovative application of various web technologies
google maps technology
Google MapsTechnology

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""><html xmlns=""><body><h1>Google Maps</h1><p>Introduction</p><ul><li>New features</li></ul><br /></body></html>

<SUBSECTION>  <SECHEAD>Contributing Faculty</SECHEAD>  <FACULTY>    <NAME>Carl Sagan</NAME>    <RANK>Professor of Physics</RANK>  </FACULTY>  <FACULTY>    <NAME>Charles Darwin</NAME>    <RANK>Professor of Biology</RANK>  </FACULTY></SUBSECTION>

<HTML><BODY BGCOLOR="#FFFFFF"><CENTER><H1>Google Maps</H1></CENTER><FONT SIZE="+1">Introduction</FONT><P><UL><LI>New features<LI>Web technologies</UL><BR></BODY></HTML>

google maps technology5
Google MapsTechnology
  • CSS, JavaScript, DHTML

DIV.exp {  position: absolute;  top: 150px;  left: 50px;  width: 700px;  height: 325px;  }<DIV CLASS="exp" ID="ex3">Text for section</DIV>document.getElementById('ex3').style.visibility="visible"

H1 {

font-family : Verdana, Helvetica, sans-serif;

text-align : center;


P {

font-family : "Times New Roman", Times, serif;

font-size : 13px;

margin-bottom : 5px;

margin-left : 15px;


<SCRIPT LANGUAGE="JavaScript">function addTax(amt) {  return parseFloat(amt) * 1.06; }</SCRIPT><INPUT TYPE="text" NAME="price" SIZE="10"ONCHANGE="document.TaxForm.withTax.value = addTax(document.TaxForm.price.value);"> Price with tax: <INPUT TYPE="text" NAME="withTax" SIZE="10">

google maps technology6
Google MapsTechnology
  • AJAX: Asynchronous JavaScript and XML

function getXmlHttpRequestObject() {

if (window.XMLHttpRequest) {

return new XMLHttpRequest();}

else if(window.ActiveXObject) {

return new ActiveXObject("Microsoft.XMLHTTP");}

else {alert("Error initializing XMLHttpRequest!"); }


google maps api
API released June 2005

Embed maps in your web pages

Add overlays (markers) to maps

Google MapsAPI
api terms of use
APITerms of Use
  • Available to non-profit and commercial sites
  • No charging or internal use
  • No inappropriate use
  • Potential for advertising
signing up
Signing Up
  • Google account (Gmail, etc.)
  • Generate maps API key
  • Used on single directory
getting started
Getting Started
  • Google JavaScript source
  • Check browser compatibility
  • Strict XHTML
getting started11
Getting Started

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"


<html xmlns="">


<script src="

key=ABAeKOi9qo8BGpObySsI" type="text/javascript"></script>

<script type="text/javascript">

if (!GBrowserIsCompatible()) {




your first map
Your First Map
  • Define map area
  • Initialize map object
  • Set center (longitude and latitude) and zoom size
  • Add controls
your first map13
Your First Map


<div id="region" style="width: 600px; height: 400px"></div>

<script type="text/javascript">

var map = new GMap2(document.getElementById("region"));

map.setCenter(new GLatLng(40.0084, -76.8756), 9);

map.addControl(new GLargeMapControl());

map.addControl(new GMapTypeControl());

adding map features
Adding Map Features
  • Map overlays
  • Event listeners
  • Info windows
  • Events and windows
adding map features16
Adding Map Features

var map = new GMap2(document.getElementById("region"));

map.setCenter(new GLatLng(40.0084, -76.8756), 9);

map.addControl(new GLargeMapControl());

map.addControl(new GMapTypeControl());

var btext = "<b>Dickinson College</b><br />Carlisle, PA";

var point = new GLatLng(40.20292, -77.19830);

var marker = new GMarker(point) ,{title:"Dickinson"};

GEvent.addListener(marker, "click", function() {




more map features
More Map Features
  • Creating icons
  • Vector polylines
  • Additional JavaScript
more map features icons
More Map FeaturesIcons

var baseIcon = new GIcon();

baseIcon.shadow = "shadow.png";

baseIcon.iconSize = new GSize(20, 34);

baseIcon.shadowSize = new GSize(37, 34);

baseIcon.iconAnchor = new GPoint(9, 34);

baseIcon.infoWindowAnchor = new GPoint(9, 2);

baseIcon.infoShadowAnchor = new GPoint(18, 25);

var icon = new GIcon(baseIcon);

icon.image = "markerA.png";

more map features vector polylines
More Map FeaturesVector Polylines

var lineC = [];

lineC.push(new GLatLng(40.1872503307, -77.1912717819));

lineC.push(new GLatLng(40.2015921347, -77.1891260147));

lineC.push(new GLatLng(40.2021493550, -77.1964645385));

var maplineC = new GPolyline(lineC,"#660000",2);


more map features additional javascript
More Map FeaturesAdditional JavaScript

function getDir (mapmarker, dirtext, mapline) {





<a href="javascript:getDir(markerC, dirC, maplineC)">

Directions from the South (Washington, Baltimore)</a>

View example

server side programming
  • Program languages and data
  • Generate JavaScript
  • Examples – campus map
server side programming22
  • Any language (Perl, CFM)
  • Data files with map info
server side programming23

<CFQUERY NAME="getbldg" DATASOURCE="maps">

SELECT * FROM campus ORDER BY bldgname


<CFOUTPUT QUERY="getbldg">

<CFSET mapletter = Chr(CurrentRow + 64)>

var point = new GPoint(-#long#, #lat#);

var marker#mapletter# = createMarker(point, "#mapletter#", "<img src='bldgs/#pic#' />");



server side programming24
  • Examples using tabbed windows, additional DHTML, overlay of buildings (with TPhoto)
  • Interactive campus map (view)
  • Downtown shopping map (view)
zip code data us census bureau
ZIP Code DataUS Census Bureau

Census 2000 U.S. Gazetteer Files

Census Tracts (66,304 records)

Places (25,375 records)

Counties (3,219 records)

County Subdivisions (36,351 records)

ZCTAs (ZIP Code Tabulation Areas) (33,233 records)


State abbreviation, zip code, population, area, latitude, longitude

zip code data campus information
ZIP Code DataCampus Information
  • Address records for alumni, students and others
  • Create maps linked to data
  • Example: alumni homes
zip code proximity alumni homes
ZIP Code ProximityAlumni Homes
  • Use map to get latitude & longitude of visible area - getBoundsLatLng()
  • Pass to server program via AJAX
  • Query for ZIP codes on map
  • Find info in alumni database
  • Return to map
zip code proximity alumni homes28
ZIP Code ProximityAlumni Homes

mborder = map.getBoundsLatLng();

var request = GXmlHttp.create();

var getURL = ""+ "minx=" + mborder.minX + "&miny=" + mborder.minY+ "&maxx=" + mborder.maxX + "&maxy=" + mborder.maxY;'GET', getURL, true);

. . .

var xmlDoc = request.responseXML;

markers = xmlDoc.documentElement.getElementsByTagName("marker");

  • Locate addresses on map (convert to geographic coordinates)
  • Google Maps API now provides a geocoding service
  • Available via HTTP or JavaScript
geocoding http request
GeocodingHTTP Request


<address>50 Mooreland Ave, Carlisle, PA 17013, USA</address>



<Thoroughfare><ThoroughfareName>50 Mooreland Ave</ThoroughfareName></Thoroughfare>




geocoding javascript

var geocoder = new GClientGeocoder();

function showAddress(address) {

if (geocoder) {


function(point) {

if (!point) {alert(address + " not found");

} else {

map.setCenter(point, 13);

var marker = new GMarker(point);



} } ); }}

  • Potential uses for Google maps on college web sites
  • Questions?