google maps api

28
Google Map API M A Hossain Tonu http://mahtonu.wordpress.com GCDC Innovation Camp @BUET

Upload: m-a-hossain-tonu

Post on 08-May-2015

2.094 views

Category:

Technology


1 download

DESCRIPTION

The Google Maps Javascript API lets you embed Google Maps in your own web pages. Version 3 of this API is especially designed to be faster and more applicable to mobile devices, as well as traditional desktop browser applications. Download Code samples at: https://app.box.com/s/p48udnd79pkeikcls66v

TRANSCRIPT

Page 1: Google Maps API

Google Map API

M A Hossain Tonuhttp://mahtonu.wordpress.com

GCDC Innovation Camp @BUET

Page 2: Google Maps API

Who am I?

• Tech Blogger http://mahtonu.wordpress.com

• PHP Hacker, Community activist, FOSS advocate

• Work = Vantage Labs Dhaka

• @mahtonu

• Authored the title “PHP Application Development with NetBeans: Beginner's Guide” http://link.packtpub.com/6HaElo

Page 4: Google Maps API

Initialize the Map var location = new google.maps.LatLng(

23.726557,

90.388506

);

var options = {

zoom: 12,

center: location,

mapTypeId: google.maps.MapTypeId.ROADMAP

};

var map = new google.maps.Map(

document.getElementById(‘map_canvas’),

options

);

Page 5: Google Maps API
Page 6: Google Maps API

GeoCodervar geocoder = new google.maps.Geocoder();

var options = {

address: "BUET, Dhaka"

};

geocoder.geocode(options, function(results, status) {

map.setCenter(

results[0].geometry.location

);

});

Page 7: Google Maps API

My Current Location<!-- HTML5! huh! -->

navigator.geolocation.getCurrentPosition(success, error);

function success(position) {

var location = new google.maps.LatLng(

position.coords.latitude,

position.coords.longitude

);

map.setCenter(location);

}

function error() { ... }

Page 8: Google Maps API

Markervar LatLng = new google.maps.LatLng(23.726557, 90.388506);

var marker = new google.maps.Marker({

position: LatLng,

map: map,

title: ‘marker title’,

icon: ‘marker icon url’

});

Page 9: Google Maps API
Page 10: Google Maps API

Placesvar input = document.getElementById(‘input’);

var autocomplete = new google.maps.places.Autocomplete(input);

autocomplete.bindTo(‘bounds’, map);

google.maps.event.addListener(

autocomplete,

‘place_changed’,

function() {

var place = autocomplete.getPlace();

...

}

);

Page 11: Google Maps API
Page 12: Google Maps API
Page 13: Google Maps API

Directionsvar service = new google.maps.DirectionsService();

var request = {

origin: from,

destination: to,

travelMode: google.maps.TravelMode.DRIVING

};

service.route(request, function(response, status) {

...

});

Page 14: Google Maps API
Page 15: Google Maps API

Time Zones

https://maps.googleapis.com/maps/api/timezone/json?

location=23.726557,90.388506&

timestamp=135189720&

sensor=false

Page 16: Google Maps API

Time Zones{

dstOffset: 0,

rawOffset: 21600,

status: "OK",

timeZoneId: "Asia/Dhaka",

timeZoneName: "Bangladesh Standard Time"

}

Page 17: Google Maps API

Local

https://maps.googleapis.com/maps/api/js? sensor=false& language=bn

Page 18: Google Maps API
Page 19: Google Maps API
Page 20: Google Maps API

Weathervar units = google.maps.weather.TemperatureUnit.CELSIUS;

new google.maps.weather.WeatherLayer({

temperatureUnits: units,

map: map

});

new google.maps.weather.CloudLayer({

map: map

});

Page 21: Google Maps API
Page 22: Google Maps API

Layersgoogle.maps.BicyclingLayer

Page 23: Google Maps API

Too many Markers?

Page 24: Google Maps API

Clusterer

url and screenshot

Page 25: Google Maps API

More than150 Features...

Page 26: Google Maps API

Q & A

Page 28: Google Maps API

Shameless Promotion!

http://link.packtpub.com/6HaElo