CloudNote: This is the third part in a series on building your own home-brewed map server  It is advisable to read the previous installments, found here and here.

Last time, I walked you through installing TileMill, and I promised a similar treatment for TileStream and Flex Viewer.  I am a man of my word, so here we go.  Don’t worry – this will be easy in comparison to what we’ve already accomplished.

We’ll start with TileStream, simply because we’re going to have to avail ourselves of the command line.  Once again, you can either plug a keyboard and monitor into your server or use whatever SSH client you’ve been using thus far.

Once you’re in the terminal, take control again (‘sudo su’).  For your TileStream installation, you can follow the installation instructions as presented, except for one detail:  it’s assumed we already have an application we don’t have.  Let’s correct that:

sudo apt-get install git

And then proceed with the installation (don’t forget to hit ‘enter’ after each command):

sudo apt-get install curl build-essential libssl-dev libsqlite3-0 libsqlite3-dev

git clone –b master-ndistro git://github.com/mapbox/tilestream.git

cd tilestream

./ndistro

And that’s that (TileStream, even more than TileMill, will throw up errors during the installation.  None of them should stop the process, though, so you can safely ignore them).  Like TileMill, TileStream needs to be started before it can be accessed in a browser.  Since the plan is to run the server headless, let’s set this up in Webmin in a fashion similar the one employed for TileMill.

Back to Webmin, again open the ‘Other’ menu, and this time click on ‘Custom Commands’.  We’ll create a new Custom Command and configure it as follows (substitute your name for mine as appropriate):

TileStream Command

Save it, and you will now have a Custom Command button to use for starting TileStream (we didn’t do this for TileMill because we cannot.  The Webmin Custom Command function simply won’t accept it.  I think it has to do with the nature of the command.  I think the ‘./’ in the TileMill command confuses it).

At this point, TileStream is fully functional, but it doesn’t yet have a tileset to work with.  Using the same browser with which you just accessed Webmin, go here to download one.  Scroll down the page, pick a tileset you like and click on it to proceed to the download page (I picked World Light).  Download the file to wherever you please.  Once you have the file, go back to Webmin and open the ‘Other’ menu again.  Click on ‘Upload and Download’, then select the ‘Upload to Server’ tab.  Click on one of the buttons labeled ‘Choose File’, then browse to the tileset file you downloaded.  For ‘File or directory to upload to’, click the button and browse your way to /home/terry/tilestream/tiles (by now, you should know you’re not ‘terry’).  Click the ‘Upload’  button.

Once your tileset is finished uploading, you can point the browser to http://maps:8888 (yeah, yeah – not ‘maps’) to access TileStream.  Enjoy:

TileStream

Our last order of business is Flex Viewer (otherwise known as ‘ArcGIS Viewer for Flex’).  This is the easiest of the lot, mainly because it doesn’t actually have to be installed.  Still using the same browser, go to the download page (you’ll need an ESRI Global Account.  If you don’t have one, create one), agree to the terms and download the current version (again – download it to wherever you please).  Once you have the package, use Webmin to upload it to the server.  This time you’ll want to upload the file to /var/www and you’ll want to check the ‘Yes’ button adjacent to ‘Extract archive or compressed files?’

And you’re in.  Point the browser to http://maps/flexviewer/ (you know the drill) and play with your new toy:

Flex

You can see I have customized the flex viewer.  You should do so as well (it’s designed for it, after all).  Open the file manager in Webmin (the ‘Other’ menu again) and navigate to /var/www/flexviwer.  Select config.xml, then click the ‘Edit’ button on the toolbar.  The rest is up to you.

* * * * *

So now you have a headless Ubuntu map server up and running, and the question you are probably asking yourself is:  “Do I really need all this stuff running in my server?”  The answer is, of course, ‘no’.  The point of this exercise was to learn a thing or two.  If you’ve actually been following along and have these applications running in your own machine, you are now in a good position to poke around for a while to figure out what sort of server you’d like to run.

For instance, there’s no real reason to run TileMill on a server.  TileMill doesn’t serve tiles, it fires them.  Therefore it’s probably not the best idea to be eating up your server’s resources with TileMill (and it seriously devours resources).  The server doesn’t have a use for the tiles until they’re done being fired, at which point TileStream is the tool for the job.

That said, there’s no compelling reason why you couldn’t run TileMill on your server.  If you’d rather not commit another machine to the task (and if you’re not in any kind of hurry), why not give the job to the server?  It’ll take it a while, but it will get the tiles fired (if your server is an older machine like mine, I would strongly advise you to fire your tiles in sections, then put them together later.  I suggest firing them one zoom level at a time and combining them with SQLite Compare).

Flex Viewer and the OpenGeo Suite don’t often go together, but there’s no reason why they can’t.  Flex Viewer can serve up layers delivered via WMS – there’s nothing to say GeoServer can’t provide that service.  They are, however, very different applications, with vastly different capabilities, strengths and weaknesses.  They also have a very different ‘feel’, and we should never discount the importance of aesthetics in the decision making process.

A final – and very important – consideration in the final configuration of our home server is the nature of the face it presents to the world.  In order for a server to serve, it must connect to and communicate with the world at large.  This means some kind of front end, the nature of which will influence at least some of our choices.

Which brings us neatly to the next post.  See you there.

About these ads