Hitmanpt Posted February 19, 2014 at 11:24 PM Report #545895 Posted February 19, 2014 at 11:24 PM (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 February 19, 2014 at 11:25 PM by Windows Dragon
taviroquai Posted February 20, 2014 at 12:43 AM Report #545903 Posted February 20, 2014 at 12:43 AM Precisas dar largura e altura a DIV com id "map_canvas"... tipo: #map_canvas { width: auto; height: 500px; }
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now