Skip to content

Instantly share code, notes, and snippets.

Created September 10, 2015 03:04
What would you like to do?
Get Latitude and Longitude from your Postal Address
if ($_REQUEST[where]) {
$where = stripslashes($_REQUEST[where]);
$whereurl = urlencode($where);
// Note - Google key is domain specific!
$location = file("$whereurl&output=csv&key=ABQIAAAAvp3__HwvT3VkixIIbsW0axQuKI_6t1bH2P0vC
// Sample - $location[0]="200,8,51.369318,-2.133457";
list ($stat,$acc,$north,$east) = explode(",",$location[0]);
$html = "Information for ".htmlspecialchars($where)."
$html .= "North: $north, East: $east<br>";
$html .= "Accuracy: $acc, Status: $stat<br>";
} else {
$html = "Space reserved for your report when form completed";
<title>Postal Address to Latitude / Longitude</title>
<body bgcolor="#99CCFF"></pre>
<div align="center">500px;"></div>
Enter a place name / address and a latitude and longitude will be returned.
<form method=post>Place: <input type="text" name="where" size="40" />
<input type=submit value=go></form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment