SELECT COUNT(*) c, city, countryLabel, NTH(1, latitude) lat, NTH(1, longitude) lng FROM ( SELECT INTEGER(PARSE_IP(contributor_ip)) AS clientIpNum, INTEGER(PARSE_IP(contributor_ip)/(256*256)) AS classB FROM [publicdata:samples.wikipedia] WHERE contributor_ip IS NOT NULL ) AS a JOIN EACH [fh-bigquery:geocode.geolite_city_bq_b2b] AS b ON a.classB = b.classB WHERE a.clientIpNum BETWEEN b.startIpNum AND b.endIpNum AND city != '' GROUP BY city, countryLabel ORDER BY 1 DESC
$map_link = "http://maps.google.com/staticmap?key={$key}&size={$w}x{$h}¢er={$lat},{$lng}&zoom={$z}";
// a mercator object$mercator = new mercator();// we'll pan 1/2 the map height / width in each go // y pixel coordinate of center lat$y = $mercator->latToY($lat);// subtract (north) or add (south) half the height, then turn back into a latitude$north = $mercator->yToLat($y - $h/2, $z);$south = $mercator->yToLat($y + $h/2, $z);// x pixel coordinate of center lng$x = $mercator->lngToX($lng);// subtract (west) or add (east) half the width, then turn back into a longitude$east = $mercator->xToLng($x + $w/2, $z);$west = $mercator->xToLng($x - $w/2, $z);
$north = "http://maps.google.com/staticmap?key={$key}&size={$w}x{$h}¢er={$north},{$lng}&zoom={$z}";$south = "http://maps.google.com/staticmap?key={$key}&size={$w}x{$h}¢er={$south},{$lng}&zoom={$z}";$east = "http://maps.google.com/staticmap?key={$key}&size={$w}x{$h}¢er={$lat},{$east}&zoom={$z}";$west = "http://maps.google.com/staticmap?key={$key}&size={$w}x{$h}¢er={$lat},{$west}&zoom={$z}";
<html><head><script type="text/javascript">function displayLocation(loc) { var locDiv = document.getElementById("locationDiv"); locDiv.innerHTML = "lat: " + loc.coords.latitude + ", lon:" + loc.coords.longitude;}function getLocation() { navigator.geolocation.getCurrentPosition(displayLocation);}</script></head><body><a href="#" onClick="getLocation()">Click here to display location</a><br><div id="locationDiv"></div></body></html>