Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<div class="container">
<div class="form-group">
<label for="latlong">Area Code:</label>
<input class="form-control" id="txtAddress" placeholder="Enter area code">
<button type="submit" class="btn btn-default" onclick="GetLocation()">Submit</button>
<button class="btn btn-default" onclick="drawChart()">Map these points</button>
<div id="map_div" style="width: 400px; height: 300px"></div>
<br />
<script type="text/javascript" src=""></script>
<script type="text/javascript">
var latitude;
var longitude;
function GetLocation() {
var geocoder = new google.maps.Geocoder();
var address = document.getElementById("txtAddress").value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
latitude = results[0];
longitude = results[0].geometry.location.lng();
return [latitude, longitude];
// latlongarr.push([latitude, longitude]);
// alert(latlongarr);
} else {
alert("Request failed.")
google.charts.load("current", {packages:["map"]});
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Lat', 'Long'],
var map = new google.visualization.Map(document.getElementById('map_div'));
map.draw(data, {showTip: true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment