google map
by Alex Azuero
HTML
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<div id="map_canvas"></div>
CSS
html, body {
height: 100%;
}
#map_canvas {
height: 100%;
width: 100%
}
JavaScript
function initialize() {
var geocoder = new google.maps.Geocoder();
var myLatlng = new google.maps.LatLng(0, 0);
var myOptions = {
zoom: 1,
//address: 'London, UK'
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
//show marker for an address
function codeAddress(address) {
geocoder.geocode({
'address': address
},
function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
map.setZoom(2);
var infowindow = new google.maps.InfoWindow({
content: '<div id="content">Location: ' + address + '</div>'
});
//var point = results[0].geometry.location;
//map.panTo(point); // Pan map to that position
//setTimeout(function(){ map.setZoom(14) },2000); // Zoom in after 1 sec
var marker = new google.maps.Marker({
position: results[0].geometry.location,
animation: google.maps.Animation.DROP,
map: map,
title: 'Hover text',
icon: 'http://www.bryantchristie.com/sites/all/themes/bci/img/icon-twitter.png'
});
//on click marker, open popup
google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
});
}
});
}
var searchTerm = 'washington',
numOfTweets = 100,
url = 'http://aamirafridi.com/twitter/?q='+searchTerm+'&count='+numOfTweets;
$.get(url, function(data){
var locations = [];
$.each(data.statuses, function(){
if(this.user.location !== "")
...