Nick’s Blog

More progress on SilverMap

by Nick on Jun.07, 2009, under GeoServer, GIS, Silverlight

SilverMap is not really aimed at becoming a real product, it is simply to allow me to get real experience of developing a Silverlight application that makes use of my GIS skills. I had already managed to create a viewer that pans around OpenStreetMaps. I added a few markers that also support clustering for when markers are too close to each other and now I support WMS.

Now some of you not from the GIS world may be wondering what WMS is. It stands for Web Map Service and essentially allows you to form a request for a bitmap (usually) of the area you are interested in. You then display this bitmap in your browser and, voila, you have a basic map. Alternatively you can render the bitmap over (or under) other data and then things start to become more interesting because a source of data from one server can be combined with another server and the user gets the impression of a single map with all the content they want.

Something that hindered me was that I wanted to use a public WMS server so that I did not have to find a way to make one work for me on my own computer at home. There are two drawbacks here, firstly I could not find one that was fast enough and secondly even if I had found such a server I would probably not have been able to make it work with Silverlight as Microsoft has created a mechanism within Silverlight that prevents an application running from one domain from calling a server in another domain. There is a workaround that involves putting a file on the server telling the Silverlight application that it is OK to make the cross domain call but the chances of me getting some public WMS server to place this file in their server is probably nill.

The rest of this blog covers the creation of my own WMS server and the problems I encountered.

So I decided to install GeoServer, a free and open source  server, onto my Vista machine. It worked like a charm and ran with some test data almost as soon as it was installed. However the drawback here is that the Vista machine is my development machine and I do not really want to have to leave it plugged in and running all the time just so that I can demo the WMS layer on my site. I thought about perhaps installing it on my already overburdened mail server but that was quickly ruled out. I thought that may be my hosting company would be able to help but as it involves installing the JDK and they are a dedicated Windows hosting provided I ruled that out too.

Then I remembered that I had an old laptop that I’d tried to get Ubuntu to work on around a year ago. I fired it up and found that probably due to a dead battery for the BIOS it was a little unhappy with life and I never managed to get it to boot properly. So I downloaded the latest server version of Ubuntu (9. something, probably called rancid rat or something equally dumb) and burned it onto a CD. I installed it onto the laptop and then added a GUI.

I then followed some fairly clear instructions for installing the JDK and then GeoServer. It was a little more work than on the Vista machine but really nothing too demanding and I quickly had a working WMS server running under linux. This is really the first time I’ve managed to get Linux to do anything I wanted and I really am beginning to see the positives. I have some grumbles and I’ll start to list them here but on the whole it was a positive experience.

Hurdles encountered

Generally all went smoothly but along the way I had some problems. I’ll list the solutions, where I have them, and provide links to other sites that were helpful.

Installing Ubuntu

Actually the only real hickup was that the first CD I burned seems to have been corrupt. I burned that with Roxio on a Vista machine and then simply started the install. For my second attempt I downloaded InfraRecorder and used that having confirmed the MD5 checksum of the download.

When you start the install you are presented with a menu and one option is to verify the CD. This is not the first option and so I did not use it first time round. Had I done so I might not have gone ahead but really no harm was done. I do think it might be better if the installer offered this option either first or even better as an optional first stage of the install. It takes quite a time but in the long run can save quite some time if you have neared the end of the install.

After installing the Ubuntu server you do not get the fancy graphical user interface. Instead you just get a command prompt. This is probably fine for most hardened Linux types but I’d have preferred it to be an option. However I was prepared for this and immediately started installing the GUI. I found the details of how to do this on the this site but here they are.

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo dpkg-reconfigure xserver-xorg
sudo /etc/init.d/gdm start

This took what seemed like an eternity to complete but it did complete and now my Ubuntu server boots right into the GUI each time.

During the install I gave the machine an IP address that I later wanted to change. The reason was quite simply that until now I had not been running a DHCP server and I decided that the Ubuntu machine’s address was right in the middle of the range I wanted to use for DHCP. I searched the GUI for an option to change the IP address and came close but never actually found one. So I went along to the trusty internet and looked there. It assured me that there was an option via the GUI but the document I was reading was for an earlier version and either they have removed that option or it does not work in the server version. I found another document that told me that I could edit a file called /etc/network/interfaces. Of course when they say edit what they really mean is drop to the command line and use VI (which I believe must stand for Virtually Inoperable). I’ll admit that I am a fan of Microsoft OS’s, well OK perhaps not a fan, I certainly do not posses any T-Shirts or bags sporting a Microsoft logo but I do like the fact that there is a GUI interface for almost all the tasks you could hope to perform and that this GUI does kind of stop you making idiot mistakes. Having to use VI to edit a file that is crucial to the system seems to me to be a fundamental design flaw. I ended up using something called nano and that worked just fine.

$ sudo nano /etc/network/interfaces

Then I changed the IP address and had to restart the networking components.

$ sudo /etc/init.d/networking restart

And that was it. Quite straight forward but I’m sure that simply typing in the IP address into a field and pressing OK would have been easier and less prone to errors and certainly not worth writing a blog about (I don’t just mean my blog, I mean all those blogs out there where I gleaned my information from).

Another gripe while I’m at it. People winge endlessly about how Vista asks you if you really want to take action ABC. Well time after time Ubuntu keeps asking me to provide my password because I am about to take an action that is security related. Quite sensible I’m sure, but let’s assume that somehow a trojan has got in and suddenly pops up a message saying enter password! How many people are really going to think, “Wait I should not have to enter my password now!”. Granted the Guru Linux types will know but everyone else will probably enter the password and now the trojan has the keys to the safe.

Another quick change I made was to simply disable the GUI animations. Repeatedly I found that while a window was being maximised or minimised it would stall half way and leave a ghostly shadow (Vista does the same sometimes). Disabling the animations was straight forward and has speeded up the GUI nicely. I might do the same on the Vista machine too.

Installing GeoServer

This is a two stage process just as it was under Windows. First you need to install the Sun JDK and after that you can download and install the GeoServer. Installing the JDK seemed to be as simple as clicking on the appropriate package in the synaptic package manager and then waiting while it installed. Once that process completed I assumed I was all set to go regards Java so I moved on to installing GeoServer.

The GeoServer download is simply a zip file which you are supposed to unpack somewhere. I really could not find a good place but decided that my own home folder was not it and set about trying to find alternatives. Trouble was that all the likely alternatives seemed to have the wrong rights and I was unable to change those rights without resorting to the command line. Now I appreciate that it would have been possible to simply drop to a command line and create a folder somewhere useful by logging in as a power user. What I do not understand is why the GUI could not be used to do the same work. But I am perfectly prepared to admit that this might simply be a lack of knowledge on my part. So for now GeoServer is indeed installed in my own personal home folder.

The next step is launching it. To do this you do need to drop to the command prompt and then simply run the script. It immediately gave me an error saying that JAVA_HOME was not set. I tried finding where the Java home might be by typing whereis java. This gave me a range of options and I believe I initially chose /usr/bin/java but this turned out to be wrong according to the script and a little investigation into the script showed it probably should have simply been /usr because it appends the bin/java. This time it launched but was clearly having problems getting going and part of the problem seemed to be that some class somewhere in some package could not be cast to some expected type. This told me that somehow I was using the wrong Java and so I resorted to Google.

What I found was this page that describes how you can get GeoServer to run under Tomcat. The command line that grabbed me here was the one about making sure the JDK was the default JVM.

sudo update-alternatives –config java

I ran this and selected the JVM from a list of options. The default was indeed not the newly installed JVM but some other. Now it could be that this is a red herring because presumably the JAVA_HOME variable should be telling the script which JVM to use. But later on the same page they advise setting this too.


Now when I started the script it seemed to work and a test call from the Vista machine confirmed it was reachable. However for it to be able to work with Silverlight it also needs to serve either clientaccesspolicy.xml or crossdomain.xml. At first I created the Microsoft file clientaccesspolicy.xml and everything worked as it should. I then changed the IP address of the machine and suddenly it stopped working. I looked at the log on the server and it suggested the client was looking for the Adobe file crossdomain.xml which Silverlight only falls back to when it cannot find it’s preferred file. So I created it and once again everything started working.

Well it has been a learning experience. Although the WMS server seems fast the installation instructions advise various changes including not using the built in jetty web server. Well performance is not really a big issue but I’d quite like to see how much extra performance I can squeeze out of the thing so I’ll do some digging.


Setting up Ubuntu was relatively simple and setting up GeoServer to run on that server was also quite easy. I am certain that commercial software vendors are starting to enhance their products to try to stay one step ahead. However given that I have a perfectly legal standards compliant spatial web server that is doing a great job for absolutely zero outlay I wonder just how far ahead they need to be.

Currently I have no statistics to compare performance and I’ll need those before I tune the server but I’d like to report back just how much of an improvement is possible.

:, , , , ,

2 Comments for this entry

  • managed hosting

    Managed hosting is meant for those websites that are designed to host busy e-commerce sites and dynamic, database driven Web pages. Perfect for organizations that don’t’ have the time or capital to invest in server administration.

  • Nick

    I’m guessing the comment above is my first piece of spam. Perhaps they offer a good product or perhaps not but either way I’m not endorsing them and as far as I can tell this comment has nothing to do with the article I wrote.

1 Trackback or Pingback for this entry

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Founder chanel replica founded the Chanel brand in Paris, France in 1913. replica gucci wide range of products, including clothing, jewelry and accessories, cosmetics, perfume, each product is famous, especially her hermes replica and replica bags . Chanel is a famous brand with more than 80 years of experience. Chanel fashion always has elegant, simple and exquisite style. She is good at breaking through the tradition. She successfully pushed the fake bags of “Five Flowers” to simple and comfortable in the 1940s. This is perhaps the earliest modern casual wear.