Google

Insertar el API de Google Weather en SharePoint

Written on:August 11, 2010
Comments
Add One

Tenemos la necesidad de colocar el tiempo de nustra ciudad en un webpart de un SharePoint. Para ello vamos a utilizar el API de Weather de Google, para obtener el XML que nos interesa debemos de escribir la siguiente url,

Por codigo postal (no se si funciona bien, solo EEUU)
http://www.google.com/ig/api?weather=46500  

Por Nombre de Ciudad (funciona correctamente)
http://www.google.com/ig/api?weather=sagunto,spain  

Con idioma (hl=es -> castellano , hl=ca -> valencià) (funciona con todos los idiomas disponibles de Google )
http://www.google.com/ig/api?weather=sagunto,spain&hl=fr

Por otra parte para poder ver que iconos nos pinta por defecto Google se puede acceder a este post http://www.blindmotion.com/?p=73  donde nos lo dice,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  <?xml version="1.0" ?>
 <xml_api_reply version="1">
 <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
 <forecast_information>
  <city data="Sagunt - Sagunto, Valencia" />
  <postal_code data="sagunto,spain" />
  <latitude_e6 data="" />
  <longitude_e6 data="" />
  <forecast_date data="2010-08-11" />
  <current_date_time data="2010-08-11 09:00:00 +0000" />
  <unit_system data="SI" />
  </forecast_information>
 <current_conditions>
  <condition data="Parcialmente nublado" />
  <temp_f data="84" />
  <temp_c data="29" />
  <humidity data="Humedad: 70%" />
  <icon data="/ig/images/weather/partly_cloudy.gif" />
  <wind_condition data="Viento: NE a 10 km/h" />
  </current_conditions>
 <forecast_conditions>
  <day_of_week data="mié" />
  <low data="22" />
  <high data="33" />
  <icon data="/ig/images/weather/sunny.gif" />
  <condition data="Despejado" />
  </forecast_conditions>
 <forecast_conditions>
  <day_of_week data="jue" />
  <low data="20" />
  <high data="30" />
  <icon data="/ig/images/weather/sunny.gif" />
  <condition data="Despejado" />
  </forecast_conditions>
 <forecast_conditions>
  <day_of_week data="vie" />
  <low data="14" />
  <high data="27" />
  <icon data="/ig/images/weather/chance_of_rain.gif" />
  <condition data="Posibilidad de lluvia" />
  </forecast_conditions>
 <forecast_conditions>
  <day_of_week data="sáb" />
  <low data="19" />
  <high data="27" />
  <icon data="/ig/images/weather/chance_of_rain.gif" />
  <condition data="Posibilidad de lluvia" />
  </forecast_conditions>
  </weather>
  </xml_api_reply>

SharePoint: Cómo mostrarlo mediante un XML Webpart?

1.Ir a la página de SharePoint que quieras agregar el tiempo.

2.Abrir esta página en vista de edición y agregar nuevos elementos Web llamado XML Web.

3.Cuando el elemento Web se agrega a continuación, abrir la ventana de configuración.

4.En XML poner url del XML del tiempo, comprobar si el XMl es correcto en “Link de prueba.

5.Apretar [XSL Editor].

6.Se abre la ventana de edición se abre y ahora insertar el código XSL (el codigo XSL es la plnatilla que ha de seguir el XML Web Part para interpretar el contenido del XMl, más info en http://w3schools.com/xsl/ ). Cuando se inserta clic en [Aceptar].

Para que todo esto nos valga la pena debemos de construir un XSL correcto para que sea interpretado.

Regidor de l'Ajuntament de Sagunt 2011-2015, apassionat de les noves tecnologies on treballe, editor, faller i creador de morvedre.info

Leave a Comment

Your email address will not be published. Required fields are marked *

*


+ nine = 12

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Optimized by SEO Ultimate