Tuesday, January 27, 2009

Venturing deeper in to the murky waters of the Geoweb...

or Neogeography...or Web 2.0...or whatever you want to call it...

Basically to keep up with the ever changing world of the GIS Analyst/Geographer, I've set upon myself the tiny minor little task of learning how to create Rich Internet Applications (RIA). I already know a little about AJAX, and have used it for small things. For those that don't know what AJAX is, it stands for Asynchronous Javascript and XML. Basically it is a way for a webpage to stay put, and the content to change. Whereas before to change the content you had to go to another webpage, this really slows things down, and isn't a good user experience. So AJAX talks to the server via Javascript and the server sends back information in XML format, and Javascript parses that info. The advantage of this process is that doesn't require any third-party extensions to get a Flashy (Adobe Flash that is) experience. I don't particularly like programming in Javascript. And in some instances you have to set up your code depending on browser the user is using, because not each browser is the necessarily the same.

So along comes Microsoft and their new product called Silverlight. The so-called "Flash-Killer." Well, it's not going to kill Flash, but some healthy competition doesn't hurt anyone. The appeal was that I could program in VB.NET to create the RIA, and it could all be developed using the Web Developer 2008 Express Edition. Develop Flash-like apps for free? Sounds better than 600$ for the cost of Adobe Flash software. The disadvantage is that Silverlight has 1% of the market to Flash's 98% (and an extra 1% for all the people still using Netscape Navigator 4), so no one really has the plugin to view the application. Forcing people to download a plug-in leaves me with a bad taste in my mouth (hence the appeal of AJAX). Granted by the time everyone upgrades to Windows 7, Silverlight will be pre-installed.

Now I'm not just doing this for fun, but it is related to an actual project. The project lead has a Mac, and Silverlight plugins aren't available for the mac (they are now). So I switched my attention to Adobe Flash, and learned about Adobe Flex. Flex is for developers (or dabblers like me) and Flash is for designers, to put it succinctly. There is a lot of overlap between them, such as the main language - ActionScript. Also, Flex 3.0 SDK is free, so you can, in theory, create Flex apps for free. They also sell Flex Builder (an IDE), or as a 60 day trial. Since I'm at an academic institution, they also provide it for free.

I was a little daunted at trying to learn another programming language (or half-learning like I usually do), but I've been pleasantly surprised by the whole experience. Flex Builder is just ok as an IDE, I much prefer working in Web Developer Express (it has much better intellisense), but I'm also used to working in it. I think that in general Flex is easier to work with than Silverlight because it has the documentation and community support/examples that Silverlight doesn't (yet?). I have a copy of Adobe Flex 3 Bible by Gassner and that is helping quite a bit. Flex also has a lot of built-in functions to make typical tasks much easier, like fading in or out. I found Silverlight's animation less intuitive. An extra bonus is that Google released a Google Maps control for flash/flex. There is a Virtual Earth wrapper for Silverlight that is really good to work with, but Google Maps has better imagery in the project area.

Anyway, if you've wanted to start working with RIA's, I think I would recommend Flex first, then AJAX, then Silverlight.

Here is a beta version of the project I've been working on. I attempted to set up the Flex front end to be generic so that all the content is received via RSS, so in theory I could just switch urls to a different RSS that read a different database. Of course, the code is a little sloppy as it was a learner project, but I should be able to clean it up for the final incarnation. There are little buggy problems with this, but I wanted to get a test up on the web. All the markers are stored as geometry in a SQL Server 2008 database and put into a GeoRSS so that it's readable by Flex. The "media" is stored in a separate table with each item using a foreign key reference to the spatial data, so that they are "geotagged." This way, as the database is updated so is the little Flex program. In the beta version of the blogspot engine, they have geotagging, so hopefully I'll be able to add blog entries as media content as well. I could try that, but then would need to add the entries to the media content table. So far images and videos are stored in a bucket on my host's server, with the link stored in the table. Any feedback or suggestions would be appreciated.

No comments: