Google Maps API
http://tinyurl.com/6xwogf
Google Maps Coverage in the Philippines
Google Maps Coverage in Philippines
For users in the Philippines, Google Maps only has satellite tiles and some hybrid tiles.
It does not have:
- Map Tiles
- Geocoding
- Driving Directions
- Local business listings
- Street View
- Localized Controls
Google Map Maker
What is Google Map Maker?
Empowers users to map and share knowledge about neighbourhoods they know best and care about
Every user can add and edit map features and contribute local information, making both mapping and deep maps possible for everyone, everywhere
Google Map Maker pushes innovation on the Geoweb
Live Demo
Google Map Maker
Example: Manila, Phillipines
What are a few use cases for Google Map Maker?
1
Map neighbourhoods that they care about (where they grew up, where they went to school, etc.)
2
Put small local businesses on the map and help other users find them
3
Map rural and suburban areas in the Vietnam – many of which do not yet have comprehensive online maps
Where is Google Map Maker launched?
Vietnam + 121 other countries
Google Map Maker Resources
Google Map Maker YouTube channel: �http://www.youtube.com/user/GoogleMapMaker
Google Map Maker help pages: �http://sites.google.com/site/mapmakeruserhelp/
Google Map Maker forum �http://groups.google.com/group/google-mapmaker
Start here! http://mapmaker.google.com
Maps API 101
The crash course
Google Maps 101: The Basics
The Google JS Maps API lets you create interactive maps using just JavaScript, HTML, and CSS.
Google Maps 101: Adding a map to your page
Javascript
Key:
<html>
<head>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQ...c"></script>
<script>
function createMap() {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.44, -122.14), 14);
}
</script>
</head>
<body onload="createMap()" onunload="GUnload()">
<div id="map" style="width:100%;height:50%"></div>
</body>
</html>
CSS
HTML
Google Maps 101: Adding a marker
var marker = new GMarker(new GLatLng(lat, lon));
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml('<h1>Hi!</p>');
});
map.addOverlay(marker);
Javascript
Key:
CSS
HTML
Google Maps 101: Adding a line
var latOffset = 0.001;
var lngOffset = 0.001;
var line = new GPolyline([new GLatLng(lat, lng-lngOffset),
new GLatLng(lat, lng+lngOffset)]);
map.addOverlay(line);
Javascript
Key:
CSS
HTML
Google Maps 101: Adding a polygon
var polygon = new GPolygon([
new GLatLng(lat, lng - lngOffset),
new GLatLng(lat + latOffset, lng),
new GLatLng(lat, lng + lngOffset),
new GLatLng(lat - latOffset, lng),
new GLatLng(lat, lng - lngOffset)],
'#f33f00', 5, 1, '#ff0000', 0.2);
map.addOverlay(polygon);
Javascript
Key:
CSS
HTML
Google Maps 101: Displaying directions
gdir = new GDirections(map,directions);
gdir.load('from: ' + address1 + ' to: ' + address2);
Javascript
Key:
CSS
HTML
#directions { width:400px;}
<div id = 'directions'></div>
address2 = '76 Buckingham Palace Road, London'
Google Maps API: Examples
Local Search API
The Google Bar
This turns the boring Google logo into a shiny new search box. When the user enters a search, it uses the Local Search API to return matches.
map.enableGoogleBar();
Suggestion: Enable the "GoogleBar" on your map.
Add this 1 line of code:
The Google Bar: Tips and tricks
You can show KML results only, local business listings only, or blended results. KML results are particularly good in countries where we don't have listings.
You can suppress the results panel for smaller maps, or send it to a different DIV.
Maps API for Flash
Flash API
How does it work?
Solution: Google Maps API for Flash
Flash API: Examples (1)
Flash API: Examples (2)
Static Maps API
Static Maps API: Introduction
Solution: The Static Maps API
http://maps.google.com/staticmap?center=37.400470,-122.072981&�zoom=13&�size=500x300&�key=abcdef
Static Maps API: Examples
3) Glotter
Static Maps API: Tips and tricks
Google Earth Plug-in API
Earth API
�
How does it work?
Solution: Google Earth API
google.earth.createInstance("map3d", initCallback);
Earth API: Examples
Earth API: Examples (2)
Google Earth Driving Simulator
Earth API: Tips and tricks
map.addMapType(G_SATELLITE_3D_MAP);
1. Add a 3D map type
map.setMapType(G_SATELLITE_3D_MAP);
2. Switch to 3D map type
Javascript
Key:
CSS
HTML
Creating Custom Maps
Creating Custom Maps
If a mapping service is lacking the imagery that you want, then you can overlay or replace it with your own.
Example:
Image Overlay Types
(GGroundOverlay)
���
(GTileLayer)
Single Image Overlays
Single Image Overlays: Examples
Various Uses:
With each of these examples, play with the zoom level and notice the degradation in image quality.��Interactive Fitting Tools:
�Dynamically Generated Counties Ground Overlay�With this example, play with the zoom level and notice the change in loading time for the overlay.�
Single Image Overlays: Conclusion
Single Image Overlays work well for areas that consist of a single map viewport and a single zoom setting. ��It’s easy to implement but suffers from performance issues and limited options. ��Applications that require larger coverage and multi-resolution data need a more robust solution.
Tiled Image Overlays
�Advantages:
Disadvantages:
Tiled Image Overlays: Tile Structure
��Try zooming and panning �on Google Maps with �"Outline Images" enabled�to see this in action.
Tiled Image Overlays: Tile Structure
Pixels:
Top (y): 0
Left (x): 0
Bottom: 255
Right: 255
Tile No.:
x:0 y:0
Tiled Image Overlays: Tile Structure
Tile No.:
x:0 y:0
Pixels:
Top (y): 0
Left (x): 0
Bottom: 255
Right: 255
Tile No.:
x:0 y:1
Pixels:
Top (y): 256
Left (x): 0
Bottom: 511
Right: 255
Tile No.:
x:1 y:0
Pixels:
Top (y): 0
Left (x): 256
Bottom: 255
Right: 511
Tile No.:
x:1 y:1
Pixels:
Top (y): 256
Left (x): 256
Bottom: 511
Right: 511
Tiled Image Overlays: Tile Structure
Tiled Image Overlays: Tile Structure
Tiled Image Overlays: Techniques
��
��
Tiles cut from images
Basic concept: You already have the image (often scanned in), and you use a script to cut it into multi-resolution tiles
Uses:
Advantages:
Disadvantages:
Tiles cut from images: Counties Example
Zoom 5
Zoom 6
Zoom 7
Zoom 8
Zoom 9
Tiles cut from images: Resources
Tiles cut from images: Conclusion
Tiles cut from images are useful for many purposes, but suffer when extending to more than a few zoom levels due to pixelation, and they can be difficult to align with a base map.
Static data tiles
Basic Concept: You have the data in some format, and you generate the tile layers just once from that data and store on your server.
Uses:
Advantages:
Disadvantages:
Static data tiles: Counties Example
Zoom 5
Zoom 6
Zoom 7
Zoom 8
Zoom 9
Static data tiles: Conclusion
Static tiles created from data are extremely fast and efficient, can be made to work with any zoom level and any area.
They don’t suffer from pixelation and are easily aligned to the map.
Since they require building in advance, time sensitive and user driven requirements are difficult to address.
Dynamic data tiles
Basic Concept: You have the data in some format, and you generate the tile layers dynamically (when the user requests them).
Uses:
Advantages:
Disadvantages:
Dynamic data tiles: Conclusion
�Dynamic tiles created “on the fly” offer great functionality at a stiff price - increased time to process and heavy load on the server. ��The benefits of dynamic tiles over static ones have to be weighed for each application.
Simulating Clickable Tiles
�Examples:
Sharing Geo data between applications
Using KML
KML: Introduction
KML: Placemarks
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Placemark>
</kml>
Headers
<name>Simple placemark</name>
</Placemark>
<description> <![CDATA[
<h1>CDATA Tags are useful!</h1>
<p><font color='red'>Text is <i>more readable</i> and
<b>easier to write</b> when you can avoid using entity
references.</font></p>
]]>
</description>
<Point>
<coordinates>-122.0.4,0</coordinates>
</Point>
Placemark definition
Placemark name
Placemark HTML description
Placemark lat/long/altitude
Javascript
Key:
CSS
HTML
KML: What to do with it
1. Display it in Google Maps
var kml = new GGeoXml('http://mydomain.com/myfile.kml');
map.addOverlay(kml)
2. Display it in Google Maps for Mobile
3. Display it in Google Earth
Javascript
Key:
CSS
HTML
KML: Submit it to Google!
1. Create the KML content and include attribution tags
<atom:author>
<atom:name>J. K. Rowling</atom:name>
</atom:author>
<atom:link href='http://www.harrypotter.com' />
2. Add a reference to the KML to your Sitemap file
<url>
<loc>http://www.example.com/example1.kml</loc>
<geo:geo>
<geo:format>kml</geo:format>
</geo:geo>
</url>
3. Submit the Sitemap to Google
Javascript
Key:
CSS
HTML