<?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>Vida en la Luna &#187; Google Earth</title>
	<atom:link href="http://vidaenlaluna.es/tag/google-earth/feed/" rel="self" type="application/rss+xml" />
	<link>http://vidaenlaluna.es</link>
	<description>Otro blog más de WordPress. De momento</description>
	<lastBuildDate>Wed, 02 Jun 2010 14:03:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>El API de Google Earth II</title>
		<link>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-ii/</link>
		<comments>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-ii/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 22:18:22 +0000</pubDate>
		<dc:creator>Dani</dc:creator>
				<category><![CDATA[Práctico]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Ejemplo]]></category>
		<category><![CDATA[Google Earth]]></category>

		<guid isPermaLink="false">http://vidaenlaluna.es/?p=289</guid>
		<description><![CDATA[Continuamos con más cosas útiles de esta API. Este post es la continuación del post anterior El API de Google Earth y KML.
Podéis ver el ejemplo en este enlace.
Movernos a un punto
Para movernos a un punto podemos hacerlo con las sentencias:
var la = ge.createLookAt(&#8221;);
la.set(XXXX, YYYYY, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 1000 );
ge.getView().setAbstractView(la);
Deberemos substituir XXXX e YYYY [...]]]></description>
			<content:encoded><![CDATA[<p>Continuamos con más cosas útiles de esta API. Este post es la continuación del post anterior <a title="El API de Google Earth y KML" href="http://vidaenlaluna.es/2009/06/el-api-de-google-earth-y-kml/" target="_blank">El API de Google Earth y KML</a>.</p>
<p>Podéis ver el ejemplo en este <a title="Ejemplos de El API de Google Earth II" href="http://vidaenlaluna.es/ejemplos/api_google_earth.html" target="_blank">enlace</a>.</p>
<p><strong>Movernos a un punto</strong></p>
<p>Para movernos a un punto podemos hacerlo con las sentencias:</p>
<p><em>var la = ge.createLookAt(&#8221;);<br />
la.set(XXXX, YYYYY, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 1000 );<br />
ge.getView().setAbstractView(la);</em></p>
<p>Deberemos substituir XXXX e YYYY por las coordenadas del punto.</p>
<p><strong>Crear un punto de interés</strong></p>
<p>Crear un punto de interés es algo mas largo. Aquí os dejo el código comentado.</p>
<p><em>//Creamos el punto<br />
var placemark = ge.createPlacemark(&#8221;);<br />
//Asignamos el texto o nombre del punto<br />
placemark.setName(&#8220;Sagrada Família&#8221;);<br />
//Lo añadimos al visor<br />
ge.getFeatures().appendChild(placemark);<br />
//Le asignamos el icono<br />
var icon = ge.createIcon(&#8221;);<br />
icon.setHref(&#8216;http://maps.google.com/mapfiles/kml/paddle/red-circle.png&#8217;);<br />
var style = ge.createStyle(&#8221;);<br />
style.getIconStyle().setIcon(icon);<br />
placemark.setStyleSelector(style);<br />
//Situamos el punto fisicamente<br />
var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);<br />
var point = ge.createPoint(&#8221;);<br />
point.setLongitude(2.1745);<br />
point.setLatitude(41.404);<br />
placemark.setGeometry(point);</em></p>
<p><strong>Opciones del visor</strong></p>
<p>Podemos modificar varias opciones en el visor:</p>
<ul>
<li>options.setStatusBarVisibility( TRUE/FALSE ): Barra de estado.</li>
<li>options.setGridVisibility( TRUE/FALSE ): Visibilidad del grid.</li>
<li>options.setOverviewMapVisibility( TRUE/FALSE ): Visibilidad del mapa de situación.</li>
<li>options.setScaleLegendVisibility( TRUE/FALSE ): Visibilidad de la escala.</li>
<li>options.setAtmosphereVisibility( TRUE/FALSE ): Visibilidad de la atmósfera.</li>
<li>options.setMouseNavigationEnabled( TRUE/FALSE ): Navegación con el ratón.</li>
<li>ge.getNavigationControl().setVisibility( ge.VISIBILITY_SHOW / ge.VISIBILITY_HIDE ): Visibilidad del control de navegación.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-ii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>El API de Google Earth y KML</title>
		<link>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-y-kml/</link>
		<comments>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-y-kml/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 14:38:10 +0000</pubDate>
		<dc:creator>Dani</dc:creator>
				<category><![CDATA[Práctico]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Ejemplo]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Earth]]></category>
		<category><![CDATA[KML]]></category>

		<guid isPermaLink="false">http://vidaenlaluna.es/?p=272</guid>
		<description><![CDATA[Los de Google han conseguido hacer un API muy potente para usar Google Earth en nuestras webs. Igual que nos pasa con el API de Google Maps, es muy sencillo utilizar este API.
Para empezar necesitaremos la clave del API, podéis conseguirla en este enlace.
Puedes ver un ejemplo en la página.
El API de Google Earth
Para cargar [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-269" style="margin: 20px;" title="Google Earth" src="http://vidaenlaluna.es/wp-content/uploads/ge-300x199.png" alt="Google Earth" width="300" height="199" />Los de Google han conseguido hacer un API muy potente para usar Google Earth en nuestras webs. Igual que nos pasa con el API de Google Maps, es muy sencillo utilizar este API.</p>
<p>Para empezar necesitaremos la clave del API, podéis conseguirla en este <a title="Registro API de Google Earth" href="http://code.google.com/apis/maps/signup.html" target="_blank">enlace</a>.</p>
<p>Puedes ver un ejemplo en la <a title="Ejemplo API Google Earth" href="http://vidaenlaluna.es/ejemplos/api_google_kml/api_google_kml.html" target="_blank">página</a>.</p>
<h2>El API de Google Earth</h2>
<p>Para cargar el API deberemos incluir el script en nuestra cabecera HTML con</p>
<p><em>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://www.google.com/jsapi?key=CLAVE_API&#8221;&gt;&lt;/script&gt;</em></p>
<p>Necesitaremos crear un div donde se mostrara el mundo. Para ello, en nuestro ejemplo creamos el div:</p>
<p><em>&lt;div id=&#8221;div_earth&#8221; style=&#8221;margin: 10px; width: 600px; height: 400px&#8221;&gt;&lt;/div&gt;</em></p>
<p>Dentro de nuestro código javascript cargamos el mundo en el div y lo inicializamos. Para ello:</p>
<p><em>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
google.load(&#8220;earth&#8221;, &#8220;1&#8243;);<br />
var ge = null;<br />
function init() {<br />
google.earth.createInstance(&#8220;div_earth&#8221;, initCallback, failureCallback);<br />
}<br />
function initCallback(pluginInstance) {<br />
ge = pluginInstance;<br />
ge.getWindow().setVisibility(true);<br />
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);<br />
}<br />
&lt;/script&gt;</em></p>
<p>Este  código es bastante genérico así que poca cosa hay que explicar.</p>
<ul>
<li>google.earth.createInstance(&#8220;div_earth&#8221;, initCallback, failureCallback): Esta linea crea la instancia de Google Earth. El primer parametro, &#8220;div_earth&#8221;, es el div donde veremos la aplicación. El segundo sera la función javascript que se llamara para la inicialización. El tercero sera la función que se llamara si hay algún error.</li>
<li><em>ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO): Mostramos los controles de navegación con los que el usuario se podrá mover, hacer zoom&#8230;</em></li>
</ul>
<h2>Uso de KML con el API</h2>
<p>Mi idea era empezar por tutoriales básicos pero, por petición de uno de nuestros lectores, voy a explicar como utilizar ficheros KML en el API. Solo explicare como utilizarlos con el API, en siguientes post entraremos en los ficheros KML para ver como crearlos. Si quereis ver el fichero KML que usaremos podeis acceder desde este <a title="Fichero KML" href="http://vidaenlaluna.es/ejemplos/api_google_kml/google_campus.kml" target="_blank">enlace</a>.</p>
<p><img class="alignleft size-medium wp-image-270" style="margin: 20px;" title="Google Earth" src="http://vidaenlaluna.es/wp-content/uploads/ge2-300x197.png" alt="Google Earth" width="300" height="197" /></p>
<p>Según la definición de la <a title="KML en la Wikipedia" href="http://es.wikipedia.org/wiki/Keyhole_Markup_Language" target="_blank">Wikipedia</a>, &#8220;KML (del acrónimo en inglés Keyhole Markup Language) es un lenguaje de marcado basado en XML para representar datos geográficos en tres dimensiones. Fue desarrollado para ser manejado con Keyhole LT, precursor de Google Earth (Google adquirió Keyhole LT en Octubre de 2004 tras lanzar su versión LT 2)&#8221;.</p>
<p>KML es usado para definir objetos en 3D, textos, puntos de interés&#8230; en mapas y vistas en 3D. En el ejemplo que os mostraré dibujaremos las instalaciones del Google Campus. Podéis ver el resultado en la imagen.</p>
<p>Para cargar el fichero KML utilizaramos la función <em>procesarKML.<br />
</em></p>
<p><em>function procesarKML()<br />
{<br />
var kmlUrl = &#8216;http://vidaenlaluna.es/ejemplos/api_google_kml/google_campus.kml&#8217;;<br />
google.earth.fetchKml(ge, kmlUrl, function(kmlObject) {<br />
if (kmlObject)<br />
{<br />
ge.getFeatures().appendChild(kmlObject);<br />
document.getElementById(&#8216;btnKML&#8217;).disabled = true;<br />
alert(&#8216;Fichero KML.correcto&#8217;);<br />
}<br />
else<br />
{<br />
alert(&#8216;Fichero KML.incorrecto&#8217;);<br />
}<br />
});<br />
}</em></p>
<p>Google.earth.fetchKml es el método del API encargado de procesar el fichero. Para ello le debemos pasar la instancia del plugin( anteriormente hemos creado la instancia en la variable ge ) y la URL del fichero KML. En el tercer parámetro enviamos la función que se ejecutara después de procesar el fichero. Esta función carga el objeto KML en el mapa si se ha procesado correctamente o alerta al usuario de que el fichero KML no es correcto.</p>
<p>Cualquier duda ya sabéis que podéis comentarla.</p>
]]></content:encoded>
			<wfw:commentRss>http://vidaenlaluna.es/2009/06/el-api-de-google-earth-y-kml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
