Jump to content

[Resolvido] Google Maps Javascript API 3 Geolocation offsetWidth error


Recommended Posts

Posted (edited)

Boas pessoal eu estou a tentar implementar a API do google maps no meu site... Mas até agr deparei-me com um problema

Visto que quero utilizar uma localização a partir de morada como por exemplo "Figueira da Foz, Portugal" eu escrevi a inicialização da seguinte maneira

var geocoder, map;
function codeAddress(address) {
geocoder = new google.maps.Geocoder();
geocoder.geocode({
	'address': address
}, function(results, status) {
	if (status == google.maps.GeocoderStatus.OK) {
		var myOptions = {
			zoom: 8,
			center: results[0].geometry.location,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
		var marker = new google.maps.Marker({
			map: map,
			position: results[0].geometry.location
		});
	}
});
}
codeAddress('Figueira da Foz, Portugal');

<script type="text/javascript"
 src="https://maps.googleapis.com/maps/api/js?v=3.exp&key={API_KEY}&sensor=false">
</script>

Eu basei-me neste post para fazer isto

http://stackoverflow.com/questions/6140303/google-maps-v3-how-to-center-using-an-address-on-initialize

O 1º Erro foi resolvido. Sem problemas agora aparece-me outro

"Google não está definido" e ao atualizar a página desaparece.

E não me aparece o mapa

aqui está o link para a página

http://lions.pcdev-pt.com/admin/map-testing.html

Edited by Windows Dragon

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.