Professional Documents
Culture Documents
Slide GeoLocation N GoogleMaps PDF
Slide GeoLocation N GoogleMaps PDF
GeoLocationwithGoogleMaps
Drag
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
The Result
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
ADDITIONAL SLIDES
SessionA142(2015)
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
CSULA
Jongwook Woo
CSULA
Computer
Information System
map_canvas
the map container <div>
should take up 100% of the height of the HTML body.
specifically declare those percentages for <body> and <html> as
well.
Jongwook Woo
SessionA142(2015)
Computer
Information System
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
CSULA
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=set_to_true_or_fals
e">
</script>
The http://maps.googleapis.com/maps/api/js
URL points to the location of Google Maps API
sensor parameter
to indicate whether this application uses a sensor to determine the user's
location
Cell or GPS
Jongwook Woo
CSULA
<div> named "map_canvas" and the size is set to "100%" which will expand to fit
the size on mobile devices.
Map Options
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
To initialize a Map
We also set the initial zoom level
mapTypeId togoogle.maps.MapTypeId.ROADMAP
Jongwook Woo
SessionA142(2015)
Computer
Information System
STIJ6044MobileAndroidProgramming
CSULA
GeoLocationwithGoogleMaps
google.maps.Map(opts?)
Creates a new map using the passed optional parameters
Computer
Information System
Jongwook Woo
CSULA
<body onload="initialize()">
To ensure that our map is placed on the page after
the page has fully loaded,
Doing so avoids unpredictable behavior
Geocoding
the process of turning an address into a geographic point.
Jongwook Woo
SessionA142(2015)
Computer
Information System
10
STIJ6044MobileAndroidProgramming
GeoLocationwithGoogleMaps
CSULA
Tutorial Code
http://code.google.com/apis/maps/documentation/javascript/tutorial.html
Example Page
http://code.google.com/apis/maps/documentation/javascript/examp
les/map-simple.html
Computer
Information System
Jongwook Woo
Map Events
CSULA
UI Events
A google.maps.Marker object can listen to the following user events
'click'
'dblclick'
'mouseup'
'mousedown'
'mouseover'
'mouseout'
Jongwook Woo
SessionA142(2015)
Computer
Information System
11
STIJ6044MobileAndroidProgramming
CSULA
GeoLocationwithGoogleMaps
Map Events
Another event handler to the map for changes to the 'zoom' property
and move the map to Darwin, Northern Territory, Australia
on receipt of the zoom_changed event:
google.maps.event.addListener(map, 'zoom_changed', function() {
setTimeout(moveToDarwin, 3000);
});
http://code.google.com/apis/maps/documentation/javascript/events.htm
l
Computer
Information System
Jongwook Woo
CSULA
Map Controls
The Zoom control displays a slider (for large maps) or small "+/-"
buttons (for small maps)
control the zoom level of the map.
default in the top left corner of the map on non-touch devices
or in the bottom left corner on touch devices.
Jongwook Woo
SessionA142(2015)
Computer
Information System
12
STIJ6044MobileAndroidProgramming
CSULA
GeoLocationwithGoogleMaps
Map Controls
The MapType control lets the user toggle between map types
(such as ROADMAPand SATELLITE).
default in the top right corner of the map.
Computer
Information System
Jongwook Woo
CSULA
Map Controls
SessionA142(2015)
Computer
Information System
13
STIJ6044MobileAndroidProgramming
CSULA
GeoLocationwithGoogleMaps
Map Controls
Computer
Information System
Jongwook Woo
CSULA
DirectionsService object
Jongwook Woo
SessionA142(2015)
Computer
Information System
14