user interaction: google maps apidjp3/classes/2011_09_inf133/...why maps? google maps api •...

22
User Interaction: Google Maps API Asst. Professor Donald J. Patterson INF 133 Fall 2011 1 Friday, October 21, 11

Upload: others

Post on 28-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

User Interaction:Google Maps API

Asst. Professor Donald J. PattersonINF 133 Fall 2011

1Friday, October 21, 11

Page 2: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Why maps?

Google Maps API

• Central to much mobile interaction work.

• It can be generalized to interactions with enormous

images very easily.

• Mapping data is a natural visualization that helps to reveal

patterns.

Friday, October 21, 11

Page 3: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Why maps?

Google Maps API

http://gigapan.org/viewGigapanFullscreen.php?auth=033ef14483ee899496648c2b4b06233cFriday, October 21, 11

Page 4: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Google Maps API

Credit: John Snow, On the Mode of Communication of Cholera, 1855Friday, October 21, 11

Page 5: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Google Maps API

• Google Maps v3 is optimized for mobile

• It used to be just for mobile but is being adapted as the

standard Maps API for all platforms

Friday, October 21, 11

Page 6: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Basics

Google Maps API v3

• Google hosts most of the code in a javascript library

• A developer includes the javascript library

• Just like jQuery

• A developer makes calls to the library to:

• display the map

• display controls

• display points

• display other U/I elements

Friday, October 21, 11

Page 7: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Basics

Google Maps API v3

• You can register event handlers

• So that when a user does something on the map, you

can do something on the webpage also (through

JavaScript)

Friday, October 21, 11

Page 8: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Basic Map Objects

Google Maps API v3

• Create a placeholder in your webpage to hold the map

object

Credit: PlanetObserver, http://www.flickr.com/photos/planetobserver/4770854356/

Friday, October 21, 11

Page 9: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Basic Map Objects

Google Maps API v3

• The size is up to you

• Android/iPhone work best at

• full screen

• Javascript can detect this for you

Friday, October 21, 11

Page 10: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Basic Map Loading

Google Maps API v3

• Loading the Google Maps Library

• Parameters for the library

• “sensor”: does your location come from a sensor?

• mandatory parameter

• allows Google to respect business agreements

• “language”: what language are the labels in?

• “region”: bias behavior toward a region

• “Paris” in TX or “Paris” in France?

Friday, October 21, 11

Page 11: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the map on the web page

Google Maps API v3

Friday, October 21, 11

Page 12: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Markers

Friday, October 21, 11

Page 13: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Icons

Friday, October 21, 11

Page 14: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Polylines

Friday, October 21, 11

Page 15: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Polygons

Friday, October 21, 11

Page 16: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Info Windows

Friday, October 21, 11

Page 17: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Putting the things on the web page

Google Maps API v3

• Info Windows

Friday, October 21, 11

Page 18: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Geocoding Addresses

Google Maps API v3

• Icons

Friday, October 21, 11

Page 19: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

More info

Google Maps API v3

• Google Maps API v3

• http://code.google.com/apis/maps/documentation/javascript/

Friday, October 21, 11

Page 20: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

How do you debug?

Google Maps API v3

• Web Developer Toolbar

• Firefox Error Console

• Internet Explorer Script Debugger

• Firebug

• Google’s GLog library

• For adding your own debugging statements

• screencast tutorials here:

• http://code.google.com/apis/maps/articles/debuggingmaps.html

Friday, October 21, 11

Page 21: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Assignment #3

• Add a map to Assignment #2

• AJAX call

• Make your table entries link to the map (center on click)

• Plot the table entries on the map

• Enhance the map in one interesting way

• For example, multiple map marker icons

• More than a custom marker or an info window

Friday, October 21, 11

Page 22: User Interaction: Google Maps APIdjp3/classes/2011_09_INF133/...Why maps? Google Maps API • Central to much mobile interaction work. • It can be generalized to interactions with

Friday, October 21, 11