Jump to content

Google Maps API


wmguk

Recommended Posts

Hi Guys,

 

I have a google Maps API installed, So I have a postcode saved in a database, and when you access the account it should show a road map of the postcode.

 

The guy who wrote the code has set it to only show postcodes within London, and any postcodes outside default to the US maps...

 

Any ideas?

 

var geocoder;
  var map;

function initialize() 
{
	geocoder = new google.maps.Geocoder();

	var latlng = new google.maps.LatLng(-34.397, 150.644);
	var myOptions = {
		zoom: 14,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}

	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}

  function codeAddress(address) {
if (geocoder) {
  geocoder.geocode( { 'address': address}, function(results, status) {
	if (status == google.maps.GeocoderStatus.OK) {
	  map.setCenter(results[0].geometry.location);
	  
	  var marker = new google.maps.Marker({
		  map: map, 
		  position: results[0].geometry.location
	  });
	} else {
	  alert("Geocode was not successful for the following reason: " + status);
	}
  });
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.