I’m trying to center a map on a LatLng I specify, but I’m not sure on how to do so. I’ve got this iframe link:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0"
marginwidth="0" src="https://maps.google.es/maps?f=q&source=embed&
hl=es&geocode=&q=Cam%C3%AD+Vell+d'Altea,+33,+L'Alf%C3%A0s+del+Pi&
aq=0&oq=cam%C3%AD+vell+d'altea+33&
sll=40.396764,-3.713379&sspn=13.49375,19.753418&ie=UTF8&hq=&
hnear=Cam%C3%AD+Vell+d'Altea,+33,+03581+L'Alf%C3%A0s+del+Pi,+Alicante,+Comunidad+
Valenciana&t=m&ll=38.570757,-0.076316&spn=0.001743,0.004128&
z=14&layer=c&cbll=38.570736,-0.076335&panoid=DplK9JGOu0KAPqoT95VMgQ&
cbp=12,309.4,,0,8.19&output=svembed"></iframe><br /><small>
I want it to be a script position using the Google API. I have this code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
http://maps.googleapis.com/maps/api/js?key=MY_KEY&sensor=false&callback=initialize>
</script>
<script type="text/javascript">
function initialize() {
var myOptions = {
center: new google.maps.LatLng(13.49375,19.75341),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
function loadScript()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?key=MY_KEY&sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
But I want to put the specific address of the iframe to the Google API I just copied. I don’t know hot to do this.
So, how can I link the map on the Google maps API?
Thanks so much.
The easy way to do this is to use a geocoding service like maps.huge.info/pinpointaddress.htm which gives you some coordinates. (For that one, you need to move the marker slightly to get it to display the coordinates).
Then, replace
13.49375,19.75341in your code with the right coordinates, say38.570918,-0.076218:Don’t ask more than one question at once. Please ask another question about StreetView. It’s not clear whether you are asking about Streetview in your API map or the Google Maps map.