Google Maps Get Directions From A Postcode To Another Postcode


Enter Your Postcode:

Destination Postcode:

  <!DOCTYPE html> 
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> 
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
  <title>Google Maps With Postcode To Postcode Directions</title> 
  <script src=""></script>
  <link href="" rel="stylesheet" type="text/css" /> 
  <script type="text/javascript" src=""></script> 
  <script type="text/javascript"> 
  var directionDisplay;
  var directionsService = new google.maps.DirectionsService();
  var map;
  function initialize() {
  directionsDisplay = new google.maps.DirectionsRenderer();
  var UK = new google.maps.LatLng(54.5728,-3.1139);
  var myOptions = {
  mapTypeId: google.maps.MapTypeId.ROADMAP,
  center: UK
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  function calcRoute() {
  var start = document.getElementById("start").value;
  var end = document.getElementById("end").value;

var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); } </script> <style type="text/css"> body { text-align: center; background-color: #f3f3f3; } .container { width: 980px; margin: 10px auto; text-align: left; } #input { background-color: #F8F8F8; border: solid 1px #E8E8E8; float: right; padding:5px; text-align:right; } .btn { border: 1px solid #777777; background: #6e9e2d; color: white; font: bold 11px 'Trebuchet MS'; padding: 4px; cursor: pointer; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } </style> </head> <body onLoad="initialize()"> <div class="container"> <div id="directionsPanel"></div> <div id="input"> <p><strong>Enter Your Postcode: </strong> <input id="start" type="text" > </p> <p><strong>Destination Postcode: </strong> <input type= "text" id="end" /> </p> <p><input type="button" class="btn" onClick="calcRoute();" value="View Directions"></p> </div> <div id="map_canvas" style="float:left;width:650px; height: 700px"></div> </div> </body> </html>

Available For Freelance:

I Am Available To Work For You Freelance, See My Skills To See If I Can Help Your Project, If I Can Help You Then Please Contact Me.

My Rates Start From £180 A Day, Discount Prices For Regular Clients And Work Over 3 Days.

I Started To Learn Web Development In 2008, I Did A Few Open University Courses While Working Full Time In The Building Trade, I Managed To Get A Diploma With Distinction

Request A Tutorial

If You Are Having Difficulty With The Development Of Your Website Or If You Are Just Starting Out Leaning Web Development And You Think I Can Help You Then Request A Tutorial, I Will Do My Best To Help You

I Dont Charge For My Services If I Can Help You With Something That Can Be Be Fixed In A Few Minutes.


If You Would Like To Advertise On This Site Then Please Contact Me, You Will Be Given Login Details To See What Day And Where Clicks Have Come From.

Prices Start From £10 A Month With Discounts Available For 3 Months Or More.

You Can Either Send Me The Banner Advert That You Have Designed Or From £10 I Can Have Designer Design A Banner For You.

Please Leave A Comment And A Rating


Chris Gave This Code Rating

I was trying to find a working example of a Google Maps postcode to postcode direction finder, i could not fin one that worked so i found one that did state to state and converted it, hope it helps image 5.00 out of 5 based on 1 ratings. 1 user reviews.

My Skills:

  • PHP 5
  • JavaScript
  • Jquery
  • XHTML Validation
  • KineticJS
  • HTML5
  • CSS - CSS3
  • SEO

My Social Networks:

  • facebook youtube