<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mooontes.com &#187; google maps api v3</title>
	<atom:link href="http://mooontes.com/tag/google-maps-api-v3/feed/" rel="self" type="application/rss+xml" />
	<link>http://mooontes.com</link>
	<description></description>
	<lastBuildDate>Sun, 12 Feb 2012 09:55:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Google Maps API V3 (javascript)</title>
		<link>http://mooontes.com/2009/07/30/google-maps-api-v3-javascript-2/</link>
		<comments>http://mooontes.com/2009/07/30/google-maps-api-v3-javascript-2/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 19:14:21 +0000</pubDate>
		<dc:creator>montes</dc:creator>
				<category><![CDATA[programacion]]></category>
		<category><![CDATA[api v3]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[google maps api v3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[reverse geocoding]]></category>

		<guid isPermaLink="false">http://mooontes.com/?p=319</guid>
		<description><![CDATA[Versión en español de este post Although the Google Maps API V3 is still quite green and much remains to be polished, it is quite usable and if you only need the basic features of Google Maps, then you can use it for your project, the new speed and usability at portable devices is a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mooontes.com/2009/07/29/google-maps-api-v3-javascript/">Versión en español de este post</a></p>
<p>Although the Google Maps API V3 is still quite green and much remains to be polished, it is quite usable and if you only need the basic features of Google Maps, then you can use it for your project, the new speed and usability at portable devices is a plus.</p>
<p>This code is an example of the use of various techniques with javascript:</p>
<ul>
<li>Map centering at user&#8217;s location</li>
<li>Event capturing</li>
<li>Reverse Geocoding</li>
<li>Use of <a href="http://google-maps-utility-library-v3.googlecode.com/svn/tags/scrollwheelzoom/1.0/docs/examples.html">Nianwei&#8217;s library</a> scrollwheelzoom (still not officially supported in V3)</li>
</ul>
<p><span id="more-319"></span></p>
<h3 style="clear:both;padding:20px;width:200px;text-align:center;margin:0px auto;"><a href="http://mooontes.com/codigo/google_maps_api_v3_en.html" target="_blank">Test the code</a></h3>
<p>And here is the code (<a href="http://validator.w3.org/check?uri=http://mooontes.com/codigo/google_maps_api_v3_en.html">validated</a> XHTML with Doctype).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;!--
** Created at 2009 July by Montes http://mooontes.com
** Under licence http://creativecommons.org/licenses/by/3.0/es/deed.es
**
** Google Maps API V3 javascript example
**
** Visitor's location map centering, event capturing,
** reverse geocoding &amp; Nianwei's scrollwheelzoom
**
**
** Creado en Julio de 2009 por Montes http://mooontes.com
** Bajo licencia http://creativecommons.org/licenses/by/3.0/es/deed.es
**
** Ejemplo de programación con Google Maps API V3
**
** Centrado del mapa en la ubicación del visitante, captura de eventos,
** reverse geocoding y uso de la libreria para hacer zoom con la rueda del ratón
--&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;es&quot; lang=&quot;es&quot;&gt;
&lt;head&gt;

	&lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0, user-scalable=no&quot; /&gt;
	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;

	&lt;title&gt;Test Google Maps API V3 -mooontes.com-&lt;/title&gt;

    &lt;style type=&quot;text/css&quot;&gt;
	html
	{
		border:0;
		padding:0;
		margin:0;
		width:100%;
		height:100%;
	}
	body
	{
		border:0;
		padding:0;
		margin:0;
		width:100%;
		height:100%;
	}
	#map_canvas
	{
		width:100%;
		height:100%;
	}
	#info
	{
		position:absolute;
		width:250px;
		height:250px;
		left:20px;
		top:300px;
		background-color:white;
		padding:5px;
		overflow:auto;
	}
    &lt;/style&gt;

	&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=false&quot;&gt;&lt;/script&gt;	

	&lt;script type=&quot;text/javascript&quot;&gt;
	var map;
	var geocoder;

	function initialize() {

		//Geocoder initialization &amp; visitor's location map centering
		geocoder = new google.maps.Geocoder();
		if (google.loader.ClientLocation)
		{
			//Search for visitor's latitude and longitude
			var latt = google.loader.ClientLocation.latitude;
			var longg = google.loader.ClientLocation.longitude;

			//Center the map at visitor's coordinates
			var latlng = new google.maps.LatLng(latt,longg);
		}
		else
		{
			//If we can't get visitor's coordinates, set Madrid as map center
			var latlng = new google.maps.LatLng(&quot;40.41153868&quot;,&quot;-3.70362707&quot;);
		}

		//Create the map
		var myOptions = {
		zoom: 5,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;), myOptions);

		//Add a listener, it will activate when the map become fully loaded
		google.maps.event.addListener(map, 'bounds_changed',function()
			{
				//First div's update to show actual location details
				actualizaUbicacion();
				//Map fully loaded, clear the listener
				google.maps.event.clearListeners(map, 'bounds_changed');
				//And add two new events, one will update the div's info when user ends dragging the map and the other when map's zoom changes
				google.maps.event.addListener(map, 'dragend',function() { actualizaUbicacion() });
				google.maps.event.addListener(map, 'zoom_changed',function() { actualizaUbicacion() });
			}
		);

	}

	function actualizaUbicacion()
	{

		//Map's center coordinates we'll use for reverse geocoding
		var lattlng = map.getCenter();

		if (geocoder)
		{
			geocoder.geocode({'latLng': lattlng}, function(results, status)
			{
				if (status == google.maps.GeocoderStatus.OK)
				{
					if (results[1])
					{
						var reverse_geo = results[1];

						var text = &quot;&lt;a href='http://mooontes.com/2009/07/30/google-maps-api-v3-javascript-2/'&gt;Back to post at mooontes.com&lt;&quot;+&quot;/a&gt;&lt;br /&gt;&lt;br /&gt;Map center: &quot;
							+ map.getCenter()+ &quot;&lt;br /&gt;&lt;br /&gt;Reverse Geocoding:&lt;br /&gt;&quot;;
						if (reverse_geo.address_components[0]) { text = text + &quot;0: &quot; + reverse_geo.address_components[0].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[1]) { text = text + &quot;1: &quot; + reverse_geo.address_components[1].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[2]) { text = text + &quot;2: &quot; + reverse_geo.address_components[2].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[3]) { text = text + &quot;3: &quot; + reverse_geo.address_components[3].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[4]) { text = text + &quot;4: &quot; + reverse_geo.address_components[4].long_name + &quot;&lt;br /&gt;&quot;; }

						text = text + &quot;5: &quot; + reverse_geo.formatted_address;

						document.getElementById('info').innerHTML = text;
					}
				}
				else
				{
					document.getElementById('info').innerHTML = &quot;No hay información de Reverse Geocoding.&quot;;
				}
			});
		}
	}

	//--&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body onload=&quot;initialize()&quot;&gt;
	&lt;div id=&quot;map_canvas&quot;&gt;&lt;/div&gt;
	&lt;div id=&quot;info&quot;&gt;&lt;a href=&quot;http://mooontes.com/2009/07/30/google-maps-api-v3-javascript-2/&quot;&gt;Back to post at mooontes.com&lt;/a&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mooontes.com/2009/07/30/google-maps-api-v3-javascript-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps API V3 (javascript)</title>
		<link>http://mooontes.com/2009/07/29/google-maps-api-v3-javascript/</link>
		<comments>http://mooontes.com/2009/07/29/google-maps-api-v3-javascript/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 20:07:52 +0000</pubDate>
		<dc:creator>montes</dc:creator>
				<category><![CDATA[programacion]]></category>
		<category><![CDATA[api v3]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[google maps api v3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[reverse geocoding]]></category>

		<guid isPermaLink="false">http://mooontes.com/?p=295</guid>
		<description><![CDATA[Aunque el API V3 de Google Maps aún está bastante verde y le falta mucho por pulir, ya es bastante usable y si sólo necesitamos las características básicas de Google Maps nos puede servir para nuestro proyecto. Este código es un ejemplo del uso de varias técnicas con javascript: Centrar el mapa en la ubicación [...]]]></description>
			<content:encoded><![CDATA[<p>Aunque el API V3 de Google Maps aún está bastante verde y le falta mucho por pulir, ya es bastante usable y si sólo necesitamos las características básicas de Google Maps nos puede servir para nuestro proyecto.</p>
<p>Este código es un ejemplo del uso de varias técnicas con javascript:</p>
<ul>
<li>Centrar el mapa en la ubicación del visitante</li>
<li>Captura de eventos</li>
<li>Reverse Geocoding</li>
<li>Uso de la <a href="http://google-maps-utility-library-v3.googlecode.com/svn/tags/scrollwheelzoom/1.0/docs/examples.html">librería de Nianwei</a> para hacer zoom con la rueda del ratón (aún no soportado oficalmente en la V3)</li>
</ul>
<p><span id="more-295"></span></p>
<h3 style="clear:both;padding:20px;width:200px;text-align:center;margin:0px auto;"><a href="http://mooontes.com/codigo/google_maps_api_v3.html" target="_blank">Probar el código</a></h3>
<p>Y aquí dejo el código, XHTML con doctype y <a href="http://validator.w3.org/check?uri=http://mooontes.com/codigo/google_maps_api_v3.html">validable</a>, a diferencia de lo que nos tiene acostumbrados google <img src='http://mooontes.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;!--
** Creado en Julio de 2009 por Montes http://mooontes.com
** Bajo licencia http://creativecommons.org/licenses/by/3.0/es/deed.es
**
** Ejemplo de programación con Google Maps API V3
**
** Centrado del mapa en la ubicación del visitante, captura de eventos,
** reverse geocoding y uso de la libreria para hacer zoom con la rueda del ratón
--&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;es&quot; lang=&quot;es&quot;&gt;
&lt;head&gt;

	&lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0, user-scalable=no&quot; /&gt;
	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;

	&lt;title&gt;Test Google Maps API V3 -mooontes.com-&lt;/title&gt;

    &lt;style type=&quot;text/css&quot;&gt;
	html
	{
		border:0;
		padding:0;
		margin:0;
		width:100%;
		height:100%;
	}
	body
	{
		border:0;
		padding:0;
		margin:0;
		width:100%;
		height:100%;
	}
	#map_canvas
	{
		width:100%;
		height:100%;
	}
	#info
	{
		position:absolute;
		width:250px;
		height:250px;
		left:20px;
		top:300px;
		background-color:white;
		padding:5px;
		overflow:auto;
	}
    &lt;/style&gt;

	&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=false&quot;&gt;&lt;/script&gt;	

	&lt;script type=&quot;text/javascript&quot;&gt;
	var map;
	var geocoder;

	function initialize() {

		//Inicializamos geocoder y centramos el mapa en la ubicación del visitante
		geocoder = new google.maps.Geocoder();
		if (google.loader.ClientLocation)
		{
			//Averiguamos latitud/longitud del visitante
			var latt = google.loader.ClientLocation.latitude;
			var longg = google.loader.ClientLocation.longitude;

			//Centramos el mapa en sus coordenadas
			var latlng = new google.maps.LatLng(latt,longg);
		}
		else
		{
			//Si no localizamos la ubicacion del visitante, centramos el mapa en Madrid
			var latlng = new google.maps.LatLng(&quot;40.41153868&quot;,&quot;-3.70362707&quot;);
		}

		//Creamos el mapa
		var myOptions = {
		zoom: 5,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		};
		map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;), myOptions);

		//Añadimos un listener, se activará cuando el mapa esté totalmente cargado
		google.maps.event.addListener(map, 'bounds_changed',function()
			{
				//Primera actualización del div que muestra los detalles de la ubicacion actual
				actualizaUbicacion();
				//Al haber cargado totalmente el mapa, eliminamos este listener
				google.maps.event.clearListeners(map, 'bounds_changed');
				//Y añadimos dos, uno se activará cuando se termine de arrastrar el mapa y otro cuando se cambie el nivel de zoom
				google.maps.event.addListener(map, 'dragend',function() { actualizaUbicacion() });
				google.maps.event.addListener(map, 'zoom_changed',function() { actualizaUbicacion() });
			}
		);

	}

	function actualizaUbicacion()
	{

		//Coordenadas del centro del mapa que usaremos para el reverse geocoding
		var lattlng = map.getCenter();

		if (geocoder)
		{
			geocoder.geocode({'latLng': lattlng}, function(results, status)
			{
				if (status == google.maps.GeocoderStatus.OK)
				{
					if (results[1])
					{
						var reverse_geo = results[1];

						var text = &quot;&lt;a href='http://mooontes.com'&gt;mooontes.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Map center: &quot;
							+ map.getCenter()+ &quot;&lt;br /&gt;&lt;br /&gt;Reverse Geocoding:&lt;br /&gt;&quot;;
						if (reverse_geo.address_components[0]) { text = text + &quot;0: &quot; + reverse_geo.address_components[0].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[1]) { text = text + &quot;1: &quot; + reverse_geo.address_components[1].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[2]) { text = text + &quot;2: &quot; + reverse_geo.address_components[2].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[3]) { text = text + &quot;3: &quot; + reverse_geo.address_components[3].long_name + &quot;&lt;br /&gt;&quot;; }
						if (reverse_geo.address_components[4]) { text = text + &quot;4: &quot; + reverse_geo.address_components[4].long_name + &quot;&lt;br /&gt;&quot;; }

						text = text + &quot;5: &quot; + reverse_geo.formatted_address;

						document.getElementById('info').innerHTML = text;
					}
				}
				else
				{
					document.getElementById('info').innerHTML = &quot;No hay información de Reverse Geocoding.&quot;;
				}
			});
		}
	}

	//--&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body onload=&quot;initialize()&quot;&gt;
	&lt;div id=&quot;map_canvas&quot;&gt;&lt;/div&gt;
	&lt;div id=&quot;info&quot;&gt;&lt;a href=&quot;http://mooontes.com&quot;&gt;mooontes.com&lt;/a&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mooontes.com/2009/07/29/google-maps-api-v3-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

