26.3.09

Using Open Layers With Arc Gis Server Rest Api Dev Summit

This presentation was made in the 2009 ESRI Developer Summit by James Fee. It shows how to use OL with ArcGIS Server both consuming map and geoprocessing services. Share/Save/Bookmark

7.3.09

Caveats when using OpenLayers consuming WMS services

OpenLayers is great API to build client side javascript map applications. It is now in the 2.7 release version an it is more than two years old. These two things makes it a good choice to build web map applications, since it has a thriving community of users and lots of success-cases alredy in use in many different environments. It also offers the possibility to add map services from different sources, such as Yahoo Maps, Microsoft Live Maps, Google Maps (of course) and, WMS servers. And here is when problems may arise if you don't have a clear idea about how WMS services work.

As every web map developer should know, WMS is an OpenGeospatial Consortium specification and according to the official definition, it allows to make requests to a WMS server and the "response to the request is one or more geo-registered map images (returned as JPEG, PNG, etc) that can be displayed in a browser application". In my opinion, here comes the confusion. A newcomer developer with a background in the usage of Google Maps may think that "onr or more" map images is something similar to a tiled service. That is not the case. Each WMS request produces just only one image (typically). Not a tiled set of images corresponding to the request. Actually, OGC is now in the process of discussion to provide an OGC standard specification to retrieve WMS tiled images. By the way, a little piece of technology patriotism here. One of the two organizations working on it is the CREAF, from the Autonomous University of Barcelona and the other being CubeWrex. WMS specification was first intented as a request - response protocol, before Google and other vendor started to provide fast tiled maps. Now, almost every customer or geoservices provider wants to add fast tiled maps to their applications.

What happen when you add a WMS service in OpenLayers? By default, OL internally prepares the request to make a sort of tiled requests to the server (you can easily see how it works using Firebug). This could be very dangeruous in terms of performance for your Map server application. Imagine 10 concurrent requests, divided into 10 tiles each one. We were demanding to the server to process 100 request at the very same moment. Obviously, the time needed to proccess the last ones would be considerable. Well, it also depends on your hardware and balancing architecture, but it is not reasonable to demand this kind of processing power when you can choose more efficient alternatives. Those alternatives could be:
  • use a single request option when adding WMS layers
    singleTile: true
  • use tiled services coming from TileCache or GeoWebCache
  • wait until the official WMS-cached specification is available (joking)
All of this is of special importance specially when consuming external or not owned WMS services, because it can heavily affects your map performance. Therefore, if you see out there a fast compelling application using just only WMS layers, it is almost sure that they are using any kind of tiling process in the background (unless they have a cloud computing farm of servers).

Side note: OL can now leverage the new ArcGIS Server REST API (clap, clap, clap)

Final question: Is it always mandatory to provide map services as WMS? Is WMS now the best protocol to deliver fast map applications?

Share/Save/Bookmark

31.1.09

Tools and Tips for Productive JavaScript Development

When it comes to develop with Javascript many experienced developers start to tremble. Just few weeks ago, speaking with a former Java Analyst friend, currenty Project Manager, told me that he get shocked when he realizes that some developers of his team were still using the terrible javascript alert() method to debug js code, instead of using, for example, Firebug. Obviously, alert() debugging has been a common practice in the past (although by this time you can also use Venkman debugger in Netscape), but now in 2009 it does not make sense.

When using firebug, you just need to type, console.log("test"), for example, to view in your firebug console panel the messages and tracings you need to check your code. Not only that, you are also able to set breakpoints in your javacript code, inspect HTML DOM tree, check the time needed by your application to load and much more.

Another important point that set back programmers form JS development is the absence of a good IDE with features such as intellisense, code completion, and so on. But now, you can use Netbeans, Eclipse, or VisualStudio to develop with javascript in the same way you do with any other programming language (almost).

An old common misconception when developing web applications was that is mostly suited to validate forms. This changes upside-down when Google started to use AJAX in Maps, and GMail. In this moment, JavaScript was taken seriously by developers. The problem is that, creating objects and using them is different form Java or C#. You need to master JavaScript skills to take advantage of the JS Object Oriented model. Nevertheless, even if you do not master this techniques you can also make use of a whole bunch of many different JS frameworks and APIs, such as jQuery, Dojo or Scriptaculus, just to mention a few of them.

So, if you are or are going to create web applications you have to take JS very seriously. Three tips:
  1. Use Firebug and a javascript friendly IDE
  2. Read something about JavaScript Object Oriented development
  3. Review some JavaScript APIs
Share/Save/Bookmark

25.1.09

Mis 10 Extensiones Preferidas de Firefox

Desde hace ya mucho tiempo vengo utilizando Firefox, como navegador web. La verdad es que estoy seguro de que si no fuera por sus extensiones pronto habría pasado a otro, como Google Chrome, o habría probado IE7. El caso es que algunas de las extensiones de FF han hecho me esté totalmente enganchado a él. Aunque he usado y probado muchas, aquí va la lista de las que uso con más regularidad tanto en el trabajo como en casa:
  1. Gmail Manager. Tengo una cuenta de GMail y es una gestor que sirve para varias cuentas. No tiene mucho misterio porque tampoco lo necesita, simplemente comprueba los mensajes y te muestra los no leídos en la parte inferior derecha de la barra de estado del FF.
  2. Sxipper. Suuuuuper útil. Un verdadero descubrimiento. Permite crear perfiles de usuario, para evitar le tediosisissisisiíma tarea de tener que rellenar siempre los formularios. Pero no se queda ahí, también permite almacenar usuarios y contraseñas, reemplanzando al gestor que viene con FF. Yo diría que me ha ahorrado horas y horas de páginas de registro.
  3. GreaseMonkey. Una extensión que es en sí misma un motor de extensiones. ¿Para qué vale?. Pues imagina una página mal programada para FF (es decir, que solo funciona para IE), con GM podemos añadir nuestro propio código para solucionar el problema. O imagina, que quieres un traductor instantáneo al hacer doble clic. O imagina un script para descargar los videos de youtube directamente a formato MP4. O imagina... Es decir, hay miles de scripts que solo tienes que descargar y hacer funcionar sobre el motor de GreaseMonkey. Muy potente.
  4. Gmarks. Es un gestor de favoritos para Google Bookmarks que se integra perféctamente en FF, sustituyendo (si se quiere) al que viene por defecto. Es decir, pulsando CONTROL+D, se almacenan los bookmarks directamente allí y permite tener  todos ellos sincronizados.
  5. Down Them All. Rememorando el primer álbum Kill'em all de Metállica, esta extensión no mata nada, pero sí que permite descargar de un tirón todos los archivos de un tipo. Por ejemplo, si quieres descarge todos los PDF de una web, esta herramienta permite que lo hagas con unos pocos clicks, en lugar de tener que ir uno por uno. Además se puede configurar por tipo de archivo para que se descarguen a las carpetas que se quiera.
  6. Lazarus. Esta es muuuuuuy útil. ¿Cuántas veces has rellenado un formulario, un cuadro de texto en una página web o una respuesta larga en un foro y ha cascado el formulario, la página o el propio equipo, echando a perder 5 minutos de redacción, ideas o lo que sea? Seguro que alguna vez ha ocurrido esto. Pues bien, con esta extensión este problema es historia ya que se encarga de ir guardando poco a poco lo que se va escribiendo en cada formulario o cuadro de texto. De este forma, cuando la página falla o ocurre algo inesperado, podemos volver a la página, pulsar con el botón derecho en el campo y allí tendremos almacenado todo lo que habíamos escrito. Simple, fácil y útil.
  7. IETab. Por desgracia, no siempre las páginas están bien construídas, y puede ser necesario abrirlas con IE. Pues bien con esta extensión no hay problema. Basta con hacer clic en el icono que se instala en la barra de estado, y sin salir de FF y solo en esa pestaña, se recarga la página pero esta vez, usando el motor de IE.
  8. GSpace. Esta extensión permite usar el espacio de GMail como disco de almacenamiento en internet. De este modo, podemos tener archivos almacenados aquí y acceder a ellos desde cualquier lugar.
  9. FEBE. Con tantas extensiones llega un momento que llega a ser necesario hacer copias de seguridad de las mismas. Esta extensión va incluso más allá, porque permite guardar la configuración completa del navegador, de forma que si cambiamos de equipo, podemos cargar todas las extensiones, contraseñas, favoritos, etc, sin necesidad de ir uno por uno. Por supuesto, las copias de seguridad se pueden programar con la periodicidad temporal que se quiera.
  10. ScribeFire. Last but not least, como dicen in inglis, la extensión que estoy usando para escribir este artículo. Permite crear entradas para los distintos blogs que hay por ahí sin salir del FF con casi todas las opciones que se puedan necesitar, videos de YouTube, enlaces, colores, etiquetas...
Share/Save/Bookmark

20.1.09

HandBrake: Create MP4 files for the PSP

I've just found the best solution to create MP4 files for my brand new PSP gadget. I've been looking for more than a month, testing different programs with really poor results. Either they were shareware versions with some functionalities reduced or they were free versions that produced incompatible formats.

But, HandBrake came into my help. HandBrake is an open source, GPL-licensed, multiplatform software to convert DVDs or video files to MPEG-4 format (which is the format used both by the PSP and Apple related gadgets). Its usage is really easy, guided by its simple GUI. You just only have to select a DVD drive or a video file as source, select an output folder (if you have already connected your PSP, you can select directly the VIDEO folder there) and choose the profile most suited to your device, PSP, iPod, iPhone or whatever other profile already provided on the right side of the GUI. The time needed to create de MP4 obviously depends on the source size, processor etc... but in my tests it has been quite fast. Moreover, you can also add a queue of tasks so you can batch all your video files conversions in just one shot and shut down the computer once the job finish.

Just one final important remark when using this program in Windows Vista. It is recommend to run it with Administrator privileges, that's said, right-click Run as administrator option in the context menu. I guess that it is something related with the cygwin backbone that the program seems to use. Hopefully, in next releases of this excelent program this will be fixed. Here below there is a screenshot of the GUI:


Share/Save/Bookmark