Sunday, January 07, 2007

Código de los conectores para Google Earth ¡liberado! bajo licencia GPL // Google Earth connectors' code now open under GPL license

Hola a tod@s,

Vuelvo de las vacaciones de Navidad con un regalo para la comunidad SIG: libero el código de mis conectores para Google Earth: el de ArcIMS, y el de servidores WMS.

Estoy de acuerdo con las iniciativas de software y datos libres, así que he decidido actuar en consecuencia y dar el código bajo licencia GPL. Están hechos en ASP, y la documentación es escasa ;-(

Los podéis encontrar en http://www12.asphost4free.com/ogomez2/Ge_bis/ge_connectors.zip

Si lo usais, solo os pido que me citéis, a ser posible con un enlace a este blog, especialmente si los vais a incluir en una página web.

Que los disfrutéis!


English version:

I am bringing you a gift from the Christmas holidays: I have decided to give the source code of the Google Earth connectors I built, as open source software (both ArcIMS and WMS).

I agree with open source software and free data philosophies, so I have decided to act according to them and give the source code under GPL license. They were done in ASP, and the documentation is poor ;-(

Please find them in the following URL: http://www12.asphost4free.com/ogomez2/Ge_bis/ge_connectors.zip

If you plan to use them, please cite me with a link to this blog, specially if you are using it from a web page.

Enjoy!

Tuesday, November 28, 2006

Nuevo informe sobre crecimiento urbano de la AEMA y el JRC // New EEA & JRC urban sprawl report




La Agencia Europea de Medio Ambiente (AEMA) y el Joint Research Centre (JRC) publican un nuevo informe sobre crecimiento urbano, del que se desprende la necesidad de que exista un marco legal europeo que lo regule.




Puede consultarse el informe en la siguiente URL:








Los datos en que se basa el informe se han realizado con tecnología y análisis SIG, principalmente en cambios de coberturas del suelo. Yo aparezco en la lista de agradecimientos ;-)




English version


The European Environment Agency (EEA) and the Joint Research Centre (JRC) have published a joint report about urban sprawl. The main conclusion that can be extracted from it is that there is a need for creating a legal framework that tackles urban sprawl in Europe.

Find the report in the following URL:

http://www.eea.europa.eu/pressroom/newsreleases/urban-sprawl-europes-ignored-environmental-challenge

The data the report is based on have been developed using GIS analyses, based on land cover changes. I have been acknowledged ;-)

Thursday, September 28, 2006

Disponible la base de datos CORINE Land Cover 2000 sin costuras / CORINE Land Cover 2000 seamless database available



La Agencia Europea de Medio Ambiente (AEMA) publica un DVD con la base de datos resultante del proyecto CORINE Land Cover 2000. Para solicitarlo, podéis dirigiros a la siguiente URL:

http://dataservice.eea.europa.eu/dataservice/metadetails.asp?id=950


Como soy uno de los 'padres de la criatura' (me refiero al DVD), os voy a contar en qué consiste:

En primer lugar, el proyecto CORINE Land Cover está cofinanciado por la Unión Europea y los países miembros de la AEMA (que son más que los países miembros de la Unión, 32 en concreto, más información en su sitio web). Consiste en, a partir de imágenes LANDSAT del proyecto IMAGE2000, fotointerpretar la cobertura del suelo para generar una clasificación que cubra todo el territorio, con una unidad de mapeo mínima de 25 hectáreas; los elementos lineales se mapean solo cuándo su anchura es mayor a 30 metros. Además, se crea también una capa de cambios de cobertura del suelo, donde se identifica la cobertura que había en CORINE 1990, y la que hay en CORINE 2000. La unidad de mapeo mínima para los cambios es de 5 hectáreas.

Una vez que los países realizan su CORINE Land Cover 2000 (y la capa de cambios), empieza el proceso de generar una base de datos europea 'sin costuras', es decir, se armonizan los datos en las fronteras entre países. Por defecto, los países mapean más allá de sus fronteras, para evitar que aparezcan huecos. Este proceso de crear la base de datos sin costuras consiste en ajustar manualmente o con procesos automáticos los polígonos a ambos lados de las fronteras.





Este proceso de armonización se realizó utilizando LIBRARIAN de ARC/INFO, puesto que la capa de polígonos es demasiado pesada para poderlo almacenar en una sola capa. Mi tarea empieza a continuación: poner la capa en ArcSDE, y definir el modo de difundir esta base de datos en el DVD.

Los pasos que seguí fueron los siguientes:

1. Cargar los datos en ArcSDE

Para cargar los datos en ArcSDE me tuve que enfrentar a la migración del formato LIBRARIAN a ArcSDE, que no es nada sencillo, puesto que el formato LIBRARIAN en realidad no crea una capa 'sin costuras', sino que crea un mosaico de capas, disimulando los bordes del mosaico, es decir, donde los polígonos están cortados. Es decir, en realidad habíamos cambiado unas costuras por otras.

Para corregir esto, exporté a una sola capa de ArcSDE solo los polígonos que no tocaban el borde del mosaico. El resto de los polígonos los fusioné con un comando dissolve. Para automatizar todo esto utilicé ArcView y Avenue. Formatos antiguos, tecnología antigua. Y sobre todo, Avenue sigue siendo fantástico para trabajar con geometrías.

2. Crear el mosaico para difusión de la base de datos sin costuras

Nada más terminar lo anterior, me plantean en la AEMA cómo difundir esta base de datos. Como una sola capa no es posible, ya que en formato shapefile ocupa más de 4GB, es decir, no se podrá abrir. Y ArcSDE es demasiado 'exclusivo' para utilizar su formato de exportación para difusión. Así que me plantean preparar un DVD, y hacer un mosaico (otra vez!) de la capa, pero utilizando la malla estándar europea de 100 kilómetros de lado.

El primer obstáculo que encontré es que los datos vectoriales están almacenados en coordenadas geográficas (sin proyectar), referidas al estándar europeo, ETRS89; pero la malla estándar está creada para la proyección Lambert Azimuthal Equal Area (LAEA), de manera que era necesario proyectar la información de CORINE Landcover a LAEA antes de exportar la información. Esto ya me exigía tener que utilizar ArcGIS Desktop, que proyecta sobre la marcha.

El segundo obstáculo es que hacer un Clip de una capa de 4GB no funciona. La solución: selecciono con cada cuadrado de la malla, lo exporto, y a éste le hago el clip. Y ya puestos, ¿por qué no meterlo también en un ZIP?

Al final hice un script Python que hacía todo eso: recorrer la malla, y por cada celda de la malla seleccionar los polígonos CORINE de debajo, exportarlos, hacerles un Clip con la malla, y meterlos en un ZIP. La parte de meterlos en un ZIP la resolví con un compresor gratuito que se puede llamar desde línea de comandos, el Filzip.

3. Hacer el master del DVD

Con la ayuda de mis compañeros en el Centro Temático, hicimos un "master" del DVD, en el que incluímos una interfaz web muy sencilla para acceder a la documentación, y poder seleccionar los ZIP por zonas.

English version

The European Environment Agency (EEA) has published a DVD with the seamless database from the CORINE Land Cover 2000 project. If you want to ask for a copy of this DVD, follow this URL: http://dataservice.eea.europa.eu/dataservice/metadetails.asp?id=950

I had an active role in the creation of this DVD, so I have decided to explain to you what it is about: first of all, the CORINE Land Cover project is co-financed by the European Union and the EEA Member Countries (they are currently 32 countries, more information on EEA's website). In this project, based on LANDSAT images from the IMAGE2000 project, land cover is photo-interpreted to classify the whole territory, using a minimum mapping unit of 25 Hectares; linear features are mapped only when their width is bigger than 30 meters. In addition, a changes layer is created, showing the change from 1990 to 2000 (based on CORINE 1990). In the case of the changes layer, the minimum mapping unit is 5 Hectares.

Once the countries build their CORINE Land Cover 2000 + the changes layer, the process for creating an European Seamless Database starts. This means that the data is harmonized between country borders. This armonization process was made using ARC/INFO's LIBRARIAN, because the layer is too heavy to create one single layer.

My job started right after that process: to load the layer in ArcSDE, and define a way to disseminate this database, using DVDs. The steps I had to go through are the following:

1. Load the Data in ArcSDE

The first issue I had to face was migrating LIBRARIAN to ArcSDE. This was not easy at all, because LIBRARIAN does not really create a seamless database. It creates a new (different) mosaic instead.

I designed a process to clean this up: I created one single layer in ArcSDE, where I loaded all the polygons that didn't touch LIBRARIAN's tiles' borders. Then I merged together the polygons left using the dissolve concept, and loading to ArcSDE afterwards. All this was done using the old ArcView GIS and Avenue. Old formats, old technology. And, above all, Avenue has no competition for automating geometries manipulation.

2. Create the new mosaic for disseminating the seamless database

Right after finishing the previous process, the EEA asked me how to disseminate this database. As one single layer is not possible (if you consider the file formats that the people normally uses); as a shapefile, the size would be bigger than 4GB, so it won't open. So the only solution was to mosaic it (again!), but in this case we decided to mosaic it using the standard 100 km european grid.

First obstacle: the CORINE vector data is stored in Geographic Coordinates (without a projection), using the European Standard, ETRS89; but the grid has been created for the Lambert Azimuthal Equal Area (LAEA) projection, so the data had to be projected before being tiled. That means that ArcGIS Desktop should be used, as it projects 'on-the-fly'.

The second problem I had to face was how to perform a clip on such a huge layer. In that case, the solution was to first select with one grid cell, then export, and finally clip the exported polygons with the grid cell, as a shapefile. Once this was done, why not adding the files into a ZIP file?

For making all this, I created a Python script that automated all these steps: loop through the grid cells, select the polygons intersecting, exporting them using the LAEA projection, clipping the exported polygons with the grid cell's geometry, and finally ZIP the shapefile. For the zipping part I used a freeware ZIP compressor that can be invoked from the command line, Filzip.

3. Prepare the DVD master

With the help of my colleagues in the Topic Centre, we prepared a DVD master, with a browser-based interface to access the documentation, and that helped the user selecting the ZIP files by zones.


Sunday, September 17, 2006

Conector universal de Google Earth a servidores WMS / Universal connector from Google Earth to WMS servers

Como prometí en mi primer post, aquí está el conector universal que permite dibujar cualquier servicio WMS en Google Earth.

Sé que la versión 4 de Google Earth (versión beta ahora mismo) trae un conector WMS (bastante escondido entre los menús y cuadros de diálogo), pero lo he probado y no ajusta bien los mapas. Y como este conector lo tengo hecho desde abril, me he decidido a hacerlo público.

Me he inspirado en los blog de Chris Tweedie, de Perth, Australia, y en los posts de Jeremy Bartley en mapdex.org, si bien el código es completamente mío. La diferencia es que esta nueva versión del script WMS reflector es independiente de su ubicación con respecto a los servidores, recibiendo el servidor WMS como un parámetro más.

La arquitectura es mucho más sencilla que en el caso de ArcIMS, puesto que una petición WMS GetMap es ya una imagen que se puede superponer en Google Earth, así que el script WMS reflector no tiene más que traducir las peticiones de Google Earth en peticiones WMS GetMap.

Este script WMS reflector está ubicado físicamente en http://www12.asphost4free.com/ogomez2/GE/wms_reflector.asp, y debe recibir obligatoriamente como parámetros el servidor y las coordenadas BBOX definidas automáticamente por el objeto NetworkLink en Google Earth. Opcionalmente puede recibir otros tres parámetros para definir las capas que debe mostrar, si debe mostrarse con el fondo transparente, y el formato de imagen.

Como en el caso del conector para ArcIMS, he creado una aplicación como ejemplo, que permite configurar lo que mostrar en Google Earth a partir de un servidor WMS. Esta aplicación es:

http://www12.asphost4free.com/ogomez2/GE/wms2ge.asp

Es importante tener en cuenta que en dicha página se proporciona una lista muy corta de servidores WMS, hay muchos más que puedes probar.

Esta aplicación ofrece tres posibilidades para configurar el mapa en Google Earth:

  • Mapa simple: como en el ejemplo de ArcIMS, todas las capas se muestran dentro de un solo objeto Network Link de Google Earth.
  • Quad tiles: carga el mapa en un mosaico, resultado de dividir la extensión del mapa en cuatro partes; es más lento, pero proporciona mayor calidad de imagen.
  • Lista de capas: crea un objeto Network Link en Google Earth por cada capa del servicio WMS seleccionada. Es mucho más lento para mostrar todas las capas, pero permite seleccionar las capas que mostrar en Google Earth y cambiar el orden de las mismas.

Que la disfrutéis!

English version

As I promised in my very first post, here you are the universal connector that allows overlaying WMS server's data in Google Earth.

I know that the new Google Earth version (currently beta) includes a quite hidden menu for adding layers from WMS servers. But I tried it, and the maps were not overlaid correctly, so I decided to publish this connector that I actually made in April, this year.

I found my inspiration in Chris Tweedie's blog, from Perth, Australia; and in Jeremy Bartley's posts in mapdex.org; the diference with the original WMS reflector script is that I made it independent from its location over the Internet, because it will receive the server name as another parameter.

The architecture (shown in the diagram above) is much simpler than in the case of the ArcIMS connector, because a WMS GetMap request is actually an image, so there is no need to parse the response back from the WMS server. Google Earth will be able to overlay it just having the correct WMS request.

The WMS reflector script is located in http://www12.asphost4free.com/ogomez2/GE/wms_reflector.asp; it should be invoked with the mandatory parameters WMS server name and BBOX (automatically sent by Google Earth). Optional parameters are the layers to be shown, the transparency of the background, and the map image format.

Just like in the case of the ArcIMS connector. I have created a sample application that allows configuring what to show in Google Earth from a WMS server:

http://www12.asphost4free.com/ogomez2/GE/wms2ge.asp

This example shows a very reduced list of WMS servers, but remember that you can try any WMS compliant server.

This application allows three different ways for creating WMS links for Google Earth:

  • Simple map: like in the ArcIMS example, shows a map with the selected layers in one single Network Link object.
  • Quad tiles: when refreshing, it will divide the map in four tiles to improve the map quality
  • List of layers: it adds one overlay per selected layer to allow turning layers on and off within Google Earth

Enjoy!

Localización de incendios forestales actualizados en Google Earth / Up-to-date Forest fires locations in Google Earth

En este post os voy a enseñar algún ejemplo de lo que se puede hacer con el conector de Google Earth a ArcIMS. El sitio web "Web Fire Mapper" (Universidad de Maryland) ofrece servicios de mapa con ArcIMS, mostrando las localizaciones, como elementos puntuales, de los incendios forestales detectados mediante teledetección gracias al sistema de respuesta rápida MODIS (MODIS Rapid Response System).

He creado los siguientes ficheros KML que utilizan el conector de Google Earth a ArcIMS:

El último ejemplo es una combinación de datos procedentes de dos servidores distintos de ArcIMS.

Os animo a que probéis el conector con vuestros propios servidores de ArcIMS (o servidores ArcIMS que conozcáis), además de los que proporciono en la lista.

Que lo disfrutéis!

English version

In this post I'd like to show you some examples using the Google Earth to ArcIMS connector. The web site "Web Fire Mapper", from the University of Maryland, offers ArcIMS map services showing the fire locations, as punctual features, detected using earth observation techniques. This detection is based on the MODIS Rapid Response System.

I have created the following KML files, using the Google Earth to ArcIMS connector:

The last example is combining data from two different ArcIMS servers.

I would also like to encourage you to try your own ArcIMS servers (or ArcIMS servers you know), in addition to the ones I provide in the list.

Enjoy!

Wednesday, September 13, 2006

Imágenes de satélite CBERS gratuitas / CBERS satellite images for free

Esa es la posición del INPE, Instituto Nacional de Pesquisas Espaciais brasileño, conocido principalmente por el software SPRING.

Desde distintas administraciones se está intentando impulsar la creación de herramientas basadas en teledetección. Hoy en día, existe un salto importante entre los expertos en teledetección y lo que puede hacer la teledetección, y las demandas de la sociedad. Si este salto se consigue rellenar, la teledetección puede aportar elementos realmente importantes.

Para rellenar este hueco, no puedo estar más de acuerdo con lo que propone y viene haciendo el INPE desde 2004: proporcionar las imágenes de forma gratuita. Todo empieza con un programa de satélites, CBERS, China-Brazil Earth Resources Satellite, realizado entre China y Brasil. Actualmente cuentan con dos tipos de satélite en órbita, CBERS-1 y CBERS-2, que recogen imágenes de entre 260 y 20 metros de resolución espacial, y con una más que aceptable resolución espectral. Y estas imágenes las distribuyen gratuitamente (aunque yo todavía no he conseguido descargarme ninguna, pero sí he visto que tienen de España).

La siguiente presentación en formato PDF es muy interesante. Es de Gilberto Cámara, director del INPE:

http://www.dsr.inpe.br/workshopgeo/program/pdf/gilberto_camara.pdf

También incluyo un par de fotos de ejemplo: una de París, y otra de Valencia:

(pulsar sobre la imagen para verla más grande) Imagen de un sector de Paris obtenida por la cámara CCD de CBERS. En la esquina superior derecha se ve el aeropuerto Charles de Gaulle, y el río Sena en la parte inferior izquierda. Al sur de esta zona está la torre Eiffel, y al norte de la torre un pequeño elemento circular tiene en su centro al arco del triunfo. La imagen fue tomada por la mañana, se puede observar la niebla.

(click on the image to make it bigger) Image of a sector of Paris obtained by the CCD camera through the CBERS recorder. In the upper right-hand corner the Charles de Gaulle airport is shown, and the Seine river in the lower left-hand corner. To the south of this area and in the other side of the river on may notice the Eiffel Tower. Northwards of the tower a small circular feature has in its center the Triumph Arc. The image was taken in the morning, an intense haze can be noticed.

(pulsar sobre la imagen para verla más grande)
Region costera en España junto a la ciudad de Valencia. En verde claro se observa las zonas agrícolas, y en verde oscuro los bosques. Dominan los terrenos sin vegetación.

(click on the image to make it bigger)
Coastal region of Spain close to Valencia city. In light green the agricultural areas are shown, in dark green the forests, terrains without any type of vegetation are dominant.






Me gustaría añadir una reflexión: en Europa estamos utilizando GMES para cubrir el hueco mencionado anteriormente. Y a pesar de colaborar en GMES, debo decir que me parece mucho más efectiva la posición de brasileños y chinos: damos las imágenes gratuitamente, e incluso el software; en un mercado tan abierto, la teledetección se adaptará de forma natural para solucionar problemas reales de la sociedad. Tal vez en Europa nos estemos equivocando, y nuestra industria de teledetección se quede atrás en comparación con países como Brasil o China.

English version:
That's INPE's point of view; INPE stands for Instituto Nacional de Pesquisas Espaciais, the brazilian National Institute for Space Research, already known because of the SPRING software.

Many public administrations are trying to help in the process for building capacities on earth observation based products. However, nowadays there is a gap between the remote sensing experts, and the society's needs. If this gap can be filled in, the earth observation will de able to introduce very interesting elements. I completely agree with what INPE suggests and is doing since 2004: provide the satellite images for free.

Everything started with the CBERS (China-Brazil Earth Resources Satellite) satellite programme, in cooperation between China and Brazil. They currently have two kind of satellites, CBERS-1 and CBERS-2, which are collecting images with a spatial resolution that goes from 260 meters to 20 meters, and with an interesting spectral resolution too. And they are distributing these images for free (well, I still have not suceeded in downloading any, but at least I could check they also have european 20 meters ones).

The next presentation from Gilberto Camara, Director of INPE, is really interesting:

http://www.dsr.inpe.br/workshopgeo/program/pdf/gilberto_camara.pdf

I have included a couple of sample images above: Paris and Valencia.

I would like to add one thought: en Europe we are using GMES for filling the abovementioned gap in. I am collaborating with GMES, but I must say I like much more the idea of the CBERS: give the images and the tools for free; you are creating such an open market that the earth observation will adapt to the society needs in a natural way. Maybe we are making a mistake in Europe going for a company-driven approach, and maybe our earth observation industry in the future will stay behind other countries such as Brazil or China.

Tuesday, September 12, 2006

Conector universal de Google Earth a ArcIMS / Universal connector from Google Earth to ArcIMS

Tengo algo que ofreceros gratuitamente: el conector universal de Google Earth a ArcIMS. Es un script al que llamas desde Google Earth con unos determinados parámetros, como el servidor ArcIMS, el servicio de mapa, y las capas que debe mostrar (además de la extensión geográfica, pero de eso se encarga Google Earth), y él se conecta a ArcIMS, pide el mapa, y se lo sirve a Google Earth. ¿Ciencia a ficción? No, pura realidad, y en muy poco código.

Me he basado en los ejemplos que he encontrado por Internet, donde a un script como éste se le llama reflector.

Más en detalle:

Lo primero que debemos investigar es el objeto NetworkLink de la especificación KML. Este objeto permite llamar a un objeto situado en Internet (en mi caso, una página ASP), a la que le pasará un parámetro BBOX, con las coordenadas WGS84 que definen la extensión de mapa que muestra en pantalla.

Así que la estrategia para hacer un script reflector es hacer un script que recoja las coordenadas, y haga una petición a un servidor de mapas concreto. Los ejemplos de Internet se han quedado ahí. Yo me preguntaba, ¿y si en la propia llamada al script del objeto NetworkLink incluyo el servidor y el servicio de mapas como parámetros? Y así lo hice.

A partir de este momento, tengo un conector universal. Puede ser invocado para traducir peticiones de Google Earth a cualquier servidor ArcIMS del mundo.

En el diagrama anterior se muestra la arquitectura de este conector universal; lo que ofrezco es el script reflector, que está ubicado en http://www12.asphost4free.com/ogomez2/GE/arcims_reflector.asp

Este script no funciona así directamente, debe ser invocado desde un objeto NetworkLink dentro de Google Earth.

Para probar cómo funciona, he creado una aplicación que, dada la ruta a un servidor ArcIMS, consulta los servicios de mapa disponibles, y te permite seleccionar las capas que quieres mostrar. Finalmente genera un fichero que deberéis salvar como .KML para poder abrirlo con Google Earth posteriormente. Esta aplicación está disponible en:

http://www12.asphost4free.com/ogomez2/GE/arcims2ge.asp

Este servidor me proporciona alojamiento gratuito junto con soporte a páginas ASP, pero no es muy estable. Si falla, paciencia, volverá a funcionar en un rato.

I have something to offer for free: the Universal connector from Google Earth to ArcIMS. It's a script that can invoked from Google Earth specifying certain parameters, such as the ArcIMS server, the map service, and the layers to show (in addition to the extent of the map, but that's the job of Google Earth); the script connect to the specified ArcIMS server, asks for the map, and makes it available to Google Earth. Science fiction? No, just the reality, and with a few coding in fact.

I based on the examples that can be found over the Internet, where a script like this is called a reflector script. More in detail:

The first thing we should investigate is the NetworkLink object in the KML specification. This object allows remote calls to an object placed over the Internet (in my case, an ASP page); Google Earth will invoke this object specifying the BBOX parameter, what means the extent of the map in WGS84 coordinates.

The main strategy for building a reflector script is collecting these coordinates, and building a map request for the specific map server using those coordinates. The examples over the Internet stopped there, but I wondered, what if I include in the call to the script the map server and the map service as parameters as well? And I made that.

Since that moment, I built an universal connector for adding ArcIMS map services into Google Earth. It can be invoked for translating Google Earth requests to any online ArcIMS server in the world.

The above diagram shows the architecture of this universal connector; what I am offering as the universal connector is the reflector script, located in http://www12.asphost4free.com/ogomez2/GE/arcims_reflector.asp

This script does not work directly, it must be invoked from a NetworkLink object inside Google Earth.

For trying it, I have created an application that allows querying an ArcIMS server, and build a KML file from the selected layers in one service. It will create a file that you should download and rename as .KML, for Google Earth to open it. This application is available under:
http://www12.asphost4free.com/ogomez2/GE/arcims2ge.asp

This server provides me with free hosting and ASP pages support, but it's not very stable. If it fails, please be patient, it will work again in a few minutes time.