<?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>Blog de diseño web y diseño grafico &#187; Google Maps</title>
	<atom:link href="http://www.mydesign.com.es/blog/category/google-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mydesign.com.es/blog</link>
	<description>herramientas, recursos y codigo para la web</description>
	<lastBuildDate>Mon, 15 Feb 2010 14:54:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Insertar y personalizar Google Maps en tu sitio web</title>
		<link>http://www.mydesign.com.es/blog/insertar-y-personalizar-google-maps-en-tu-sitio-web/</link>
		<comments>http://www.mydesign.com.es/blog/insertar-y-personalizar-google-maps-en-tu-sitio-web/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 13:29:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mapas]]></category>

		<guid isPermaLink="false">http://www.mydesign.com.es/blog/?p=144</guid>
		<description><![CDATA[En los sitios web de una compañía a menudo se utilizan mapas para mostrarle a los clientes dónde los pueden encontrar. Para esto, Google Maps es excelente. Pero ¿No sería genial añadir el logo de nuestra compañía, los estacionamientos cercanos, las estaciones de trenes,  y otros datos alternativos en el mapa para ayudar más [...]]]></description>
			<content:encoded><![CDATA[<p>En los <strong>sitios web</strong> de una compañía a menudo se utilizan <strong>mapas</strong> para mostrarle a los<strong> clientes</strong> dónde los pueden encontrar. Para esto, <strong>Google Maps</strong> es excelente. Pero ¿No sería genial<strong> añadir el logo</strong> de nuestra compañía, los estacionamientos cercanos, las estaciones de trenes,  y otros <strong>datos alternativos</strong> en el mapa para <strong>ayudar</strong> más a los clientes?</p>
<p>Encontramos via el blog <a href="http://www.elwebmaster.com/general/insertar-y-personalizar-google-maps-en-tu-sitio-web" target="_blank">elwebmaster</a> este genial post traducido al español en el que se ven los detalles mas importantes referidos al tema.</p>
<p>Antes de empezar, veamos lo que vamos a crear:</p>
<div class="iframe-wrapper">
  <iframe src="http://dl.getdropbox.com/u/32709/googlemaps/index.html" frameborder="0" style="height:300px;width:500px;">Please upgrade your browser</iframe>
</div>
<p><span id="more-144"></span></p>
<h2>API Google Maps API</h2>
<p>La API Google Maps te permite embeber mapas directamente en tu sitio web. Sólo se necesita un poco de JavaScript, y algo de CSS para embellecer. Recientemente ha sido lanzada la <a title="Google Maps API V3" href="http://code.google.com/apis/maps/documentation/v3/" target="_blank">Version 3</a> de la API Google Maps que es la que vamos a utilizar.</p>
<h2>Obteniendo las coordenadas</h2>
<p>Como seguramente no conocen las coordenadas precisas de su locación, les explicaremos una forma rápida que Google ha puesto a nuestra disposición para conocerlas. Cuando conoces la dirección exacta, puedes ingresar una URL de esta forma:</p>
<div>
<div id="php-1">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">http:<span style="color: #ff9933; font-style: italic;">//maps.google.com/maps/geo?q=1+Infinite Liip,+Cupertino,+CA+95014,+USA&amp;output=csv&amp;oe=utf8&amp;sensor=false&amp;key=your_google_maps_api_key </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Cuando ingreses esto en tu barra de direcciones, verás lo siguiente:</p>
<p><a title="&quot;The coordinates of Apple's head quarter in Cupertino&quot; " href="http://stiern.com/site/wp-content/everything/apple_coordinates.png"><img src="http://www.elwebmaster.com/wp-content/uploads/2009/10/apple_coordinates.png" alt="apple_coordinates" width="245" height="28" /></a></p>
<p><em>Las coordenadas del cuartel general de Apple en Cupertino</em></p>
<p>El primer número es el código de estado, y 200 quiere decir que todo está bien. El segundo número muestra cuán precisa es la dirección, en este caso el número es 8, que es bastante bueno. Los últimos dos números son latitudes y longitudes, que son los números que necesitamos.</p>
<h2>Añadiendo el mapa a tu web</h2>
<p>Abre tu editor HTML favorito y crea un archivo HTML estándar con codificación UTF-8. Primero que nada es necesario crear el puerto de visualización y decirle a nuestro archivo HTML que obtenga el archivo Javascript del código Google. Añade estas líneas entre &lt;head&gt; y &lt;/head&gt;:</p>
<div>
<div id="php-2">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;meta name=<span style="color: #ff0000;">&#8220;viewport&#8221;</span> content=<span style="color: #ff0000;">&#8220;initial-scale=1.0, user-scalable=no&#8221;</span> /&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;script type=<span style="color: #ff0000;">&#8220;text/javascript&#8221;</span> src=<span style="color: #ff0000;">&#8220;http://maps.google.com/maps/api/js?sensor=false&#8221;</span>&gt;&lt;/script&gt;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Luego de la URL, notarás sensor=false. Dado que no utilizamos ningún sensor, como un GPS, para localizar el lugar, esto se programa en false.</p>
<p>Justo debajo de lo que hemos insertado, escriban lo siguiente:</p>
<div>
<div id="php-3">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;script type=<span style="color: #ff0000;">&#8220;text/javascript&#8221;</span>&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> initialize<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> latlng = <span style="color: #000000; font-weight: bold;">new</span> google.maps.LatLng<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">57</span>.<span style="color: #800000;">0442</span>, <span style="color: #800000;">9</span>.<span style="color: #800000;">9116</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> settings = <span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">zoom: <span style="color: #800000;">15</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">center: latlng,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">mapTypeControl: <span style="color: #000000; font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">mapTypeControlOptions: <span style="color: #006600; font-weight: bold;">{</span>style: google.maps.MapTypeControlStyle.DROPDOWN_MENU<span style="color: #006600; font-weight: bold;">}</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">navigationControl: <span style="color: #000000; font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">navigationControlOptions: <span style="color: #006600; font-weight: bold;">{</span>style: google.maps.NavigationControlStyle.SMALL<span style="color: #006600; font-weight: bold;">}</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">mapTypeId: google.maps.MapTypeId.ROADMAP</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>En la línea 2 creamos la función initialize(). Dentro de esta function vamos a definir las configuraciones básicas del mapa. En la línea 3 creamos una nueva variable, latlng. latlng que representa las latitudes y longitudes. La variable contiene las coordenadas que utilizaremos como centro de nuestro mapa.</p>
<p>Luego de esto creamos la variable settings. Aquí tenemos muchas opciones.</p>
<ul>
<li>zoom específica cuánto zoom tundra el mapa.</li>
<li>center específica nuestro centro. Al escribir latlng, nos referemos a la variable que hemos creado antes y se utilizará la coordenada dentro de ésta.</li>
</ul>
<p>El último código cambia el diseño del mapa para que sea un poco más minimalista. Los controles en la esquina superior derecha (Map, Satellite, Terrain) se cambian por un menu desplegable y los controles de navegación/escalamiento en el lado izquierdo se cambiar por controles pequeños.</p>
<p>mapTypeId: google.maps.MapTypeId.ROADMAP define que nuestro mapa debe ser del tipo ROADMAP &#8211; lo puedes cambiar por SATELLITE, HYBRID o TERRAIN.</p>
<p>Debajo del código anterior, escriban esto:</p>
<div>
<div id="php-4">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> map = <span style="color: #000000; font-weight: bold;">new</span> google.maps.Map<span style="color: #006600; font-weight: bold;">(</span>document.getElementById<span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">&#8220;map_canvas&#8221;</span><span style="color: #006600; font-weight: bold;">)</span>, settings<span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Este código crea la variable map, y define que el mapa debe utilizar las configuraciones que hemos creado.</p>
<p>Escriban</p>
<div>
<div id="php-5">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Para terminar la función, y en  &lt;body&gt;, escriban esto:</p>
<div>
<div id="php-6">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;body onload=<span style="color: #ff0000;">&#8220;initialize()&#8221;</span>&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;div id=<span style="color: #ff0000;">&#8220;map_canvas&#8221;</span> style=<span style="color: #ff0000;">&#8220;width:800px; height:500px&#8221;</span>&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Al hacer esto le decimos a nuestro sitio que ejecute la función the initialize() al cargar, y que inserte un &lt;div&gt; con el tamaño que deseamos que tenga nuestro mapa.</p>
<h2>Añadiendo marcadores</h2>
<p>Ahora debemos añadir algunos marcadores. Comencemos por crear los estándar y luego los personalizaremos.</p>
<p>Justo debajo de:</p>
<div>
<div id="php-7">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> map = <span style="color: #000000; font-weight: bold;">new</span> google.maps.Map<span style="color: #006600; font-weight: bold;">(</span>document.getElementById<span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">&#8220;map_canvas&#8221;</span><span style="color: #006600; font-weight: bold;">)</span>, settings<span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Inserten el siguiente código:</p>
<div>
<div id="php-8">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyPos = <span style="color: #000000; font-weight: bold;">new</span> google.maps.LatLng<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">57</span>.<span style="color: #800000;">0442</span>, <span style="color: #800000;">9</span>.<span style="color: #800000;">9116</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyMarker = <span style="color: #000000; font-weight: bold;">new</span> google.maps.Marker<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">position: companyPos,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">map: map,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">title:<span style="color: #ff0000;">&#8220;Some title&#8221;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Primero, hemos creado la variable companyPos, dónde especificamos la posición del marcador. Luego hemos creado al marcador en sí utilizando la variable companyMarker.</p>
<h2>Personalizando los marcadores</h2>
<p>Podemos hacer mucho más bonitos nuestros marcadores. Simplemente creemos una imagen en Photoshop con un tamaño de 100×50 pixeles, y creemos algo similar a esto:</p>
<p><img src="http://www.elwebmaster.com/wp-content/uploads/2009/10/logo.png" alt="logo" width="100" height="50" /></p>
<p>Luego, creemos una sombra para la imagen:</p>
<p><img src="http://www.elwebmaster.com/wp-content/uploads/2009/10/logo_shadow.png" alt="logo_shadow" width="130" height="50" /></p>
<p>Para añadir estas imágenes como marcadores, tenemos que cambiar el código del marcador por esto:</p>
<div>
<div id="php-9">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyLogo = <span style="color: #000000; font-weight: bold;">new</span> google.maps.MarkerImage<span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">&#8216;images/logo.png&#8217;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Size<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">100</span>,<span style="color: #800000;">50</span><span style="color: #006600; font-weight: bold;">)</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Point<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">0</span>,<span style="color: #800000;">0</span><span style="color: #006600; font-weight: bold;">)</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Point<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">50</span>,<span style="color: #800000;">50</span><span style="color: #006600; font-weight: bold;">)</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyShadow = <span style="color: #000000; font-weight: bold;">new</span> google.maps.MarkerImage<span style="color: #006600; font-weight: bold;">(</span><span style="color: #ff0000;">&#8216;images/logo_shadow.png&#8217;</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Size<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">130</span>,<span style="color: #800000;">50</span><span style="color: #006600; font-weight: bold;">)</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Point<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">0</span>,<span style="color: #800000;">0</span><span style="color: #006600; font-weight: bold;">)</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">new</span> google.maps.Point<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">65</span>, <span style="color: #800000;">50</span><span style="color: #006600; font-weight: bold;">)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyPos = <span style="color: #000000; font-weight: bold;">new</span> google.maps.LatLng<span style="color: #006600; font-weight: bold;">(</span><span style="color: #800000;">57</span>.<span style="color: #800000;">0442</span>, <span style="color: #800000;">9</span>.<span style="color: #800000;">9116</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyMarker = <span style="color: #000000; font-weight: bold;">new</span> google.maps.Marker<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">position: companyPos,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">map: map,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">icon: companyLogo,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">shadow: companyShadow,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">title:<span style="color: #ff0000;">&#8220;Company Title&#8221;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>La variable companyImage apunta al nombre de la imagen logo. Luego define el tamaño, origen y el tip de la imagen (dónde estará la imagen añadida a la coordenada). Luego, hacemos exactamente lo mismo para la sombra en la variable companyShadow. En la variable companyMarker añadimos icon y shadow, y listo.</p>
<p>Ahora, si actualizan tu sitio verás que el marcador ha cambiado por su propio logo. Para añadir más marcadores, sigan simplemente el mismo método, cambiando los nombres de las variables.</p>
<p>Si tienen dos marcadores muy cerca el uno del otro, quizá deban agregar algo de z-index. El marcador con el z-index más alto, es el que más arriba está:</p>
<p><img src="http://www.elwebmaster.com/wp-content/uploads/2009/10/zindex.png" alt="zindex" width="147" height="87" /></p>
<p>Añadir zIndex nos permite seleccionar qué marcador debe ir arriba.</p>
<div>
<div id="php-10">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> companyMarker = <span style="color: #000000; font-weight: bold;">new</span> google.maps.Marker<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">position: companyPos,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">map: map,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">icon: companyImage,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">shadow: companyShadow,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">title:<span style="color: #ff0000;">&#8220;Høgenhaug&#8221;</span>,</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">zIndex: <span style="color: #800000;">4</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<h2>Añadiendo cajas de información</h2>
<p>Para añadir una descripción de tu compañía cuando un visitante hace clic en el logo podemos agregar un infobox. Con la API Google Maps esto es fácilisimo.</p>
<p><img src="http://www.elwebmaster.com/wp-content/uploads/2009/10/infobox.png" alt="infobox" width="500" height="398" /></p>
<p>Peguemos este código luego de definir la variable map:</p>
<div>
<div id="php-11">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> contentString = <span style="color: #ff0000;">&#8216;&lt;div id=&#8221;content&#8221;&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;div id=&#8221;siteNotice&#8221;&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;/div&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;h1 id=&#8221;firstHeading&#8221;&gt;Høgenhaug&lt;/h1&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;div id=&#8221;bodyContent&#8221;&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.&lt;/p&gt;&#8217;</span>+</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;/div&gt;&#8217;</span>+</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #ff0000;">&#8216;&lt;/div&gt;&#8217;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> infowindow = <span style="color: #000000; font-weight: bold;">new</span> google.maps.InfoWindow<span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">content: contentString</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Para hacer que las cajas de información aparezcan al hacer clic en nuestro logo, simplemente debemos añadir este código justo antes del último } en la función initialize():</p>
<div>
<div id="php-12">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">google.maps.event.addListener<span style="color: #006600; font-weight: bold;">(</span>companyMarker, <span style="color: #ff0000;">&#8216;click&#8217;</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #006600; font-weight: bold;">(</span><span style="color: #006600; font-weight: bold;">)</span> <span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">infowindow.open<span style="color: #006600; font-weight: bold;">(</span>map,companyMarker<span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span><span style="color: #006600; font-weight: bold;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p>Para hacer un poco más bonita la caja de información, añadamos algo de estilo en nuestra hoja de estilos:</p>
<div>
<div id="php-13">
<div>
<ol>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">body <span style="color: #006600; font-weight: bold;">{</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">font-family: Helvetica, Arial, sans-serif;</div>
</li>
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">font-size:10pt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: #006600; font-weight: bold;">}</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>Y ahí lo tienen. Un Google Map bonito y fácilmente añadido en su sitio web o blog.</p>
<h2>Descarga</h2>
<p>Para descargar los archivos de muestra hagan <a href="http://dl.getdropbox.com/u/32709/googlemaps.zip" target="_blank">clic aquí</a>.</p>
<p>Fuente: <a href="http://stiern.com/tutorials/adding-custom-google-maps-to-your-website" target="_blank">Stiern</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mydesign.com.es/blog/insertar-y-personalizar-google-maps-en-tu-sitio-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

