There surely cannot be too many people who have not now heard of Silverlight but,
just to recap for those that have not, it is essentially Microsoft's equivalent
of Flash or to put it another way a browser plug in that will allow developers to
create highly interactive and professional content.
But what does this mean for the average web user and indeed for the web developer?
Well anyone browsing the web for many years now will be familiar with having to
occasionally download and install various applications to get the site to work.
Flash has almost become an essential part of the web user's toolkit. Now some users
will either need to install something new or live without using that web site (or
possibly the developer will create a non Silverlight version too). Currently Silverlight
is aimed at the most common users and those are IE and Firefox users on Windows
and Mac systems, everyone else will have to hope that something else follows soon.
I'd guess that while Flash is extremely common and Microsoft have a long way to
go before catching up in terms of installed copies they do have the advantage that
they can always package it up with the next service pack so that every Windows user
has Silverlight overnight.
So if Microsoft have created a free plug in for their own and other browsers even
running on other operating systems then what have they to gain? As far as I can
tell it seems the way Microsoft creates money from this is by selling extremely
expensive tools to the web site developers. Sure WPF and Silverlight support are
built into Visual Studio 2008 but using it is almost as painful as using Notepad
to create a web site. You really need to consider some of the family members of
the Expression Blend suit and for some purposes you really have no option.
So what do I think of Silverlight? Well let me start by going back a few years.
When I first started working in the GIS field, some ten years ago, I was working
for a company that had an excellent tool for creating interactive maps on the Internet.
The downside was that the end user had to download a massive (in those days dial
up was normal) plug in that was several MB's. Only then could the end user really
start using the map. The plug in in question (ACGM) really only worked seamlessly
in IE and could be just about made to work with Netscape (yes that long ago) if
the user was prepared to do the work of installing themselves. Even now, ten years
on, there are plenty of companies that do not allow users to choose what they install
on their work machines and will run proxies to filter out suspicious tags such as
<object/>. Of course Flash is affected by both these issues but with the larger
install base having to download a new plug in is rarely a problem for the user of
a site that uses Flash but I've already outlined a strategy that Microsoft could
use to combat the installed users problem.
But the actual Silverlight concept itself is actually rather good. For someone like
myself who has years and years of experience of .Net and C# it was not difficult
to create the following application. The application is a gallery viewer for the
photo section of this site. Granted it could have ben made to look more flashy and
it does not do everything that I wanted yet but considering how little code is involved
I am really quite pleased with the results. It has none of that typical Windows
GUI look to it (well perhaps the scroll bar could do with a tweak). The gallery
contents are retrieved using a call to a web service that returns the details of
the thumbnails, their sizes, the full sized images and their sizes and also the
caption (not used in this application). With almost no effort on my part the application
will size the images to fit and will also sacrifice some room in the list when things
get a little cramped. You cannot see this here because this page uses a fixed width.
Now I'm sure you will be thinking this is all very nice but nothing that could not
This application may have been easy for me to make but why should every web user
that visits this page be made to pay for my laziness. The answer is that they should
not. This application is simply a "Hello World" for me. I would like to extend it
but only in ways that are still broadly speaking possible using standard HTML. It
would be nice to add a kind of shopping cart so that a visitor could request copies
of the images. It would be nice to have a kind of thumbs up/down option so that
people can vote. It would be good to see those image captions I spoke of too.
It occurs to me that you do not often (if ever) see a shopping cart implemented
in Flash. The reason is obvious, you do not want a shopping cart that is not accessible
to a certain part of your audience so if you choose to use Flash they you are going
to have to have an HTML alternative too and if you are going to have that then why
bother with the Flash version. Silverlight is going to be no different. Sure for
Intranet solutions it allows a truly powerful user experience because you know that
all the users will already have the plug in. Silverlight is essentially a subset
of something called WPF and that is what Microsoft is putting forward as the next
big thing in user interface development. Even the first tutorial that I followed
showed how I could convert the news reader application created in the tutorial into
a desktop application in a few easy steps. Well given that it is so easy to create
a desktop application out of a web application perhaps it will be possible to create
applications that target either, desktop for Windows users and the same application
running in a browser for others.
Silverlight and GIS
Something that has plagued the GIS world is selecting the right plug in. After ACGM
my former client moved towards something called SVG. The plug in for that is now
no longer supported by it's creator and while IE requires this and other browsers
do not, the others only have partial SVG implementation. Flash is an option but
it seems that Silverlight has been chosen as the most likely succesor to SVG and
that is something I'd like to work on too.
The map above is another Silverlight application that does not really demonstrate
anything too new about Silverlight. It is a simple map that allows you to zoom and
pan around a raster based map a little like Google or Virtual Earth. Again the main
benefit is to the developer (me) because creating this application took a relatively
small amount of time and can run on any supported browser.
Again the application supports resizing but because this is a fixed view you will
have to take my word for it. You could click on the full screen button in the top
right too. However this also shows a restriction of Silverlight. Silverlight does
not natively support the mouse wheel (used here to zoom in and out) and instead
we have to hook into the underlying browser. When we go full screen there is no
browser any more and the scroll wheel stops working. Something else that is a little
annoying is that Silverlight only has a concept of a left mouse button that can
be pressed or released (so no double click). I am beginning to think this is to
try to force developers to build to the lowest common denominator and some systems
that Microsoft have stated they wish to target have very basic input devices (for
example the Mac or Windows Mobile).
The next step for this application would perhaps be to allow the overlay of content.
My first attempt has been to show point data (markers). Moving on from there we could
allow support for WMS servers (in theory this is easy if you can find servers that
support the right coordinate system, applying transforms to raster data is possible
with Silverlight so I could also try to transform images from one coordinate system
I've added support for markers. They can be added from code but in this case I make
a call to a web service that returns a list of the venues that I've photographed at.
When you click on a venue icon there is also support for a popup window. The content
of the window is also based on a call to a web service and that is why you will see
a slight delay before the list of upcoming and past events is populated. Another nice touch is
allowing smooth scrolling of the map when you use the navigation arrows. I've not
made any kind of zoom in or out annimation and do not really plan to do so. The
reason for the panning animation is not entirely frivolous, not only has it shown
me a little of the world of WPF annimations but it has also shown me how to use
DependencyObjects and dependency properties (anyone familiar with the property bag
concept of old should be able to get a grasp quite easily). However the real reason
for implementing the animated panning comes back to the pop up. At the time of writing
the popup appears top left and if that happens to be where you clicked well hard
luck. My intention is to make the popup appear in a location that fits the location
of the marker but if the marker needs to be moved it can be. However suddenly shifting
the map could lead to a temporary map blindness for the user who will suddenly need
to get their barings again. It is far better to smoothly scroll the map to the new
I've also been toying with the idea of allowing some kind of vector overlay. Annoyingly
Microsoft decided to take a perfectly good open standard (SVG) that is very widely
used in the GIS world and make XAML ever so slightly different. There have been
big debates elsewhere about the rights and wrongs of ignoring the SVG standard and
my opinions are not going to sway Microsoft one bit. However it seems sad that Microsoft
did not decide to support rendering of SVG within Silverlight.
But what does it matter? Well I've mentioned vector overlays, and for that I'll
need to take geometry information and render it as points, lines, and areas. Much
of the existing geometry information is delivered in SVG, other information is in
GML and a lot is delivered as KML. Obviously if SVG were already supported then
I'd have an immediate supply of data to show but instead I'll plod on with some
of the other standards.
As a brief footnote to the SVG discussion. There are a number of projects out there
that are making it possible to convert SVG to XAML. Most of these are desktop applications
that allow an SVG file to be read and a XAML file to be written. This is not really
ideal for the web where you need to dynamically convert the data. I have heard of
an XSLT transformation that is supposed to be able to do the trick (Toine de Greef
) but looking at the code it does not look
like it has been kept up to date.
I briefly touched on the fact that the content of the marker popup is dynamic. It
can be as simple as a piece of text or it can be any full blown content as shown
here. Something I really like about Silverlight is that creating dynamic content
is really quite easy and the source of that content can be either a local XAML
file, a dynamically created user control, or even XAML parsed from and external
source such as a web server. I am sure that this flexibility is going to lend
itself to creating dynamic map overlays.
You will notice that if you navigate away from the map and back again that the map
resets to it's default position. I'd like to try to overcome this with the use of
some kind of persistance. Several options are open to me, the cookie is one and
another is the 1MB of sotrage that is made available to Silverlight applications.
I am sure both have their pros and cons so I'll have to decide later which I'll