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
https://forums.phpfreaks.com/topic/195323-google-maps-api/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.