Un Dato Varios Formatos: Generado Salidas con XSLT

20
Un Dato Varios Formatos: Generado Salidas con XSLT Gabriel Asato

Transcript of Un Dato Varios Formatos: Generado Salidas con XSLT

Un DatoVarios Formatos:Generado Salidas con XSLTGabriel Asato

Cuál es el Problema?

Hay gran diversidad de plataformas, equipos y sistemas que utilizan datos geoespaciales

GPS, Celulares, navegadores, aplicaciones diversas, etc.

Ante esta realidad, Cómo hago para que una mayor cantidad de usuarios usen mis datos sin que esto signifique un gran esfuerzo?

Diversidad de Plataformas

Garmin, Trimble, Google Earth, Google Maps, GeoRSS, WMS, WFS, KML, Nokia Maps, etc. etc. etc.

Problema

Generar un informe sobre Emergencias para GPS, Web, Google Earth, Telèfonos Celulares, Correo electrònico.

Las Soluciones

Interoperabilidad?

Elección de estándares abiertos?

Datos Originarios

Servicio WEB del INDEC, INTA

WMS de IGN, SEGEMAR

GeoRSS de CONAE

Datos GeoRSS<?xml version="1.0" encoding="ISO-8859-1"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss"> <author> <name>CONAE</name> </author> <title>CONAE - Focos de Calor</title> <updated>2008-09-22T17:19:30Z</updated> <entry> <author> <name>CONAE</name> </author>

<id>CONAE_Focos_de_Calor_Foco_1</id><title>CONAE - Focos de Calor - Imagen 1 Foco 1</title><subtitle>Satelite AQUA - Instrumento MODIS</subtitle><updated>2008-09-22T17:19:30Z</updated><georss:point>-33.560902 -59.450153</georss:point>

</entry>...... <entry>

<author> <name>CONAE</name> </author>......</feed>

Salida de DatosEstàndares Abiertos Utilizados

GPXNokia MapsKMLHTMLy eventualmente otros estàndares basados en XML

Qué es XSLT

XSL (Extensible Stylesheet Language) Familia de lenguajes basados en XML que permite describir cómo la información contenida en un documento XML debe ser transformada.

XSLT: Metodología de transformación de documentos XMLEs un estándar de W3C

XSL == Style Sheets para XML

XSLT transformar

XPath navegar

XSL-FO formatear

Paquetes Libres Utilizados

Pythonhttp://www.python.org/

Se utilizó para ejecutar los servicios web, leer y agregar los xml.

Kernowhttp://kernowforsaxon.sourceforge.net/

Es una aplicación visual para ejecutar transformaciones XLST, XQuery y Esquemas XML, basado en SAXON.

SAXON XSLThttp://saxon.sourceforge.net/

Kernow

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gml="http://www.opengis.net/gml">

<xsl:template match="/"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><img width="100" src="gpip.jpg"/><br/><img src="institutos.jpg"/><br/>

Código XSL 1

Código XSL 2<!-- HAY QUE HACER QUE FILTRE LOS DATOS DE NODOS QUE NO TIENEN NINGUNA POBLACION--> <xsl:for-each select="//hspot/provincia"> <xsl:sort select="./nombre" /> <xsl:value-of select="./nombre"/><br/>

<table border="1" style="font-family:arial; font-size:10pt" >

<tr><td colspan="3"><xsl:value-of select="../gml:Point/gml:coordinates"/><br/>Tipo de cobertura de suelo:<xsl:value-of select="../LandUse"/></td></tr>

<xsl:for-each select="../provincia"> <tr> <xsl:choose> <xsl:when test=".//localidad/distancia &lt; 3"> <td width="400" bgcolor="red">

<xsl:value-of select=".//localidad/nombre"/><br/>

<xsl:variable name="ymin" select="number(substring-before(../gml:Point/gml:coordinates,',')) - .1" /> <xsl:variable name="ymax" select="number(substring-before(../gml:Point/gml:coordinates,',')) + .1" /> <xsl:variable name="xmin" select="number(substring-after(../gml:Point/gml:coordinates,',')) - .1" /> <xsl:variable name="xmax" select="number(substring-after(../gml:Point/gml:coordinates,',')) + .1" />

Código XSL 3 <img width="400" height="400" src="http://www.sig.igm.gov.ar/wmsconnector/com.esri.wms.Esrimap/PROSIGA_V?REQUEST=GetMap&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;BBOX={$xmin},{$ymin},{$xmax},{$ymax}&amp;LAYERS=22,21,19,16,15,14,13,12,11,10,2&amp;SRS=EPSG:4326&amp;WIDTH=400&amp;HEIGHT=400&amp;FORMAT=image/jpeg" />

</td> </xsl:when>

<xsl:when test=".//localidad/distancia &gt; 6"> <td width="400" bgcolor="green"><xsl:value-of select=".//localidad/nombre"/></td> </xsl:when>

<xsl:when test=".//localidad/distancia &gt; 3 and .//localidad/distancia &lt; 6"> <td width="400" bgcolor="yellow"><xsl:value-of select=".//localidad/nombre"/></td> </xsl:when>

<xsl:otherwise> <td width="400" ><xsl:value-of select=".//localidad/nombre"/></td> </xsl:otherwise> </xsl:choose>

GPX<?xml version="1.0" encoding="UTF-8"?><gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:topografix="http://www.topografix.com/GPX/Private/TopoGrafix/0/2" version="1.0" creator="GPIP" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://wwww.topografix.com/GPX/1/0/gpx.xsd"><name>GPIP - Focos de Calor</name><author>GPIP</author><email>[email protected]</email><email>[email protected]</email><url>http://gpip.ign.gob.ar</url><time/>

<keywords>hotspot, MODIS, CONAE, GPIP, hazard management</keywords><description>Focos de calor detectados con Modis y procesados por CONAE. Procesamiento XML GPIP </description><wpt lon="-60.737354" lat="-19.60397&#34; &gt;&#xA; "><sym>Dangerous Area</sym><name>GPIP HotSpot</name><desc> Foco de calor Fecha: 2010-11-01T14:25:09Z Coordenadas del punto: -19.60397, -60.737354 Tipo de cobertura de suelo: Poblaciones cercanas al foco de calor </desc></wpt><wpt lon="-63.891727" lat="-19.253773&#34; &gt;&#xA; "><sym>Dangerous Area</sym><name>GPIP HotSpot</name><desc>*******

KML............<Placemark><xsl:text>&#xA;</xsl:text>..............................<styleUrl>#hotspot</styleUrl><xsl:text>&#xA;</xsl:text><Point><xsl:text>&#xA;</xsl:text><coordinates><xsl:text>&#xA;</xsl:text><xsl:value-of select="number(substring-after(./gml:Point/gml:coordinates, ','))" />,<xsl:value-of select="number(substring-before(./gml:Point/gml:coordinates, ','))"/></coordinates><xsl:text>&#xA;</xsl:text></Point><xsl:text>&#xA;</xsl:text></Placemark><xsl:text>&#xA;</xsl:text>

KML

HTML

Conclusiones

La gran ventaja de utilizar XSLT para generar salidas es que con un sólo origen de información uno puede satisfacer los requerimientos y necesidades de distintos usuarios en distintas plataformas