Marble's Secrets Part III: The Earth in a Download
Today we'll finish our first trilogy about Marble Desktop Globe:
In Part III we'll look beyond Marble's offline mode: We'll get to know how Marble fetches its data from the internet.
By data we mostly refer to texture data. As of version 0.5.x (KDE 4.0) we only support a single texture layer. However this is about to change with the next version of Marble: David Roberts has added support for Sun Shading in Marble. If this wasn't exciting enough he also added a way to have the "Earth at Night" map blended onto the dark side of the earth. This includes a pretty nice Terminator line. On top of that he already added internal support for having real-time clouds as another layer! See the screenshot based on a current build of the Qt-version of Marble pre-0.6-SVN.
A really big mosaic of tiles ...
Actually I've met a lot of people recently who weren't aware of the fact that Marble downloads further texture data from the internet while browsing the map. On one hand the reason for this misconception is maybe the fact that we only provide very little additional online data right now (about 400 MB). On the other hand the map download is done automatically and very seamlessly in the background, so people will hardly notice. Andrew Manson created a nice YouTube video while he finished his GSoC Project "GPS support for Marble". During the first 1.5 minutes Andrew demonstrates what could be a summary of the "Marble Secrets Part II" hands-on paragraph: the video shows how you can hide and show layers using the legend tab. Watch closely at 1:35 where Andrew zooms into the "Earth at Night" Map: you can see how the map will suddenly show a lot more detail as new data has arrived on the computer in the background. Keep watching and you'll see the same happening with the "Satellite View" map.
From Part I we know that internally the current map gets provided at different sizes - each size at different resolutions. These different map "levels" are split into 675x675 pixel tiles each. Depending on the zoom level only those tiles that are actually visible will get loaded into the physical memory ("RAM") of our computer. This mechanism keeps physical memory consumption low. For each tile Marble will check first whether it's available in the physical memory's Tile Cache (yes, you were about to suggest this feature, but we got it implemented already!). If it's not available in the "Tile Cache" Marble will try to load it from the local hard disc. In case it's not there Marble will schedule the tile for download in Marble's very own HttpDownloadManager. But wait - what should we display in the meantime while there is no matching tile available? After all due to the way Marble works we can't simply "omit" the missing tile!
As a cheap but smart workaround Marble just scales up the tile at the biggest zoom level that is locally available for this particular place. It will then just cut out the area that is needed and will use this handcrafted DIY-tile as a temporary replacement until the "real" data arrives.
In the meantime the HttpDownloadManager will contact the server and will look for the tile in question (e.g. it might look for this one ) .
So Marble will fetch the tile from the server and will store it locally on the hard disc - again sticking to the given tile directory hierarchy. Once it got stored locally Marble will update the temporary data of the texture tile to match the "real" data.
This mechanism works pretty well already. The HttpDownloadManager is also used to download the Wikipedia webpages that get displayed if you left-click on city labels or symbols.
Get Hot New Maps ...
But what if you don't just want to zoom into maps that exist on your hard disc already. What if you want new maps on your computer?
The beauty is that once the .dgml file and a few base tiles are in place Marble can start again to look for further tiles on the server.
But why doesn't Marble just download all the tiles from the server in a single download? Well, Blue Marble Next Generation is the most comprehensive free satellite map that covers the whole earth at a resolution of 500 meters per pixel. And this map takes about 350 Megabytes on the server already. With increasing resolution the size occupied on the server will grow exponentially. Even if you cover just the continents at a resolution of up to 30 meters per pixel ( Like NASA's NLT LandSat map does ) then your satellite map will occupy almost 200 Gigabytes on the server! So it's pretty obvious that for an application like Marble it's the best solution to just download the pieces that are actually needed! We plan to provide higher resolution maps on the server in the future. Given that we can't just change the maps easily once we start to provide them, this requires careful planning, so please be patient.
If you're using the Qt-only version of Marble then you're out of luck as it doesn't have the DXS feature built-in (It does have the automatic HttpDownloadManager though). You're then on your own and you need to find and install the maps manually.
Marble Junior Jobs
Today we have several exciting opportunities to let your name enter the CREDITS section in Marble. The "EASY Category" might only take you as little as an hour to complete!
To make sure that you won't waste time on a Junior Job ("JJ") while somebody else might already be about to submit a patch you can claim a JJ. Just tell us in the comments section that you have just started to work on it. Please be aware that once you have started time is running up! For reasons of fairness you should send us a preliminary patch within the following 8 hours. This will make your claim permanent for the next few days.
For help or questions you can join us on IRC ( irc.kde.org, #kde-edu ) or send a mail to our mailing list.
wouldn't it be nice if the http fetcher only tries to fetch if solid reports we're online? ;-)
Maybe another nice JJ...
Well, the download mechanism is part of the library (which is Qt-Only), however I agree that it would be easy to let the Kde application get notified by solid if the internet is available and hence switch Marble's HttpDownloadManager on or off.
trying out JJ1
I'm trying to get a patch for the first Junior Job. Hope it'll work out :-)
I tried digging in the sourcecode and changing some parts, but apparently it didn't work out too well so far.
Here's what I have at the moment:
--- src/marble_part.h (Revision 774283)
+++ src/marble_part.h (Arbeitskopie)
@@ -48,6 +48,7 @@
void showFullScreen( bool );
void showSideBar( bool );
void showStatusBar( bool );
+ void showSun();
@@ -69,6 +70,7 @@
+ KAction *m_showSunAct;
--- src/marble_part.rc (Revision 774283)
+++ src/marble_part.rc (Arbeitskopie)
@@ -18,7 +18,8 @@
--- src/marbleui.rc (Revision 774283)
+++ src/marbleui.rc (Arbeitskopie)
@@ -19,6 +19,7 @@
--- src/marble_part.cpp (Revision 774283)
+++ src/marble_part.cpp (Arbeitskopie)
@@ -37,6 +37,7 @@
@@ -198,6 +199,15 @@
m_statusBarExtension->statusBar()->setVisible( isChecked );
+ if (!m_sunControlDialog) m_sunControlDialog = new SunControlWidget( this, m_controlView->sunLocator() );
QPixmap mapPixmap = m_controlView->mapScreenShot();
@@ -285,6 +295,11 @@
m_fullScreenAct = KStandardAction::fullScreen( 0, 0, widget(), actionCollection() );
connect( m_fullScreenAct, SIGNAL( triggered( bool ) ), this, SLOT( showFullScreen( bool ) ) );
+ // Action: Show Sunshade options
+ m_showSunAct = new KAction( this );
+ actionCollection()->addAction( "show_sun", m_showSunAct );
+ m_showSunAct->setText( i18n( "S&un Control" ) );
I'll continue with that tomorrow, hopefully I'll find the solution then...
Re: first steps
Looks like a good start so far. If you run into trouble just ask on #kde-edu or on our mailing list. Good Luck :)
Trouble when trying to start Marble
Due to a faulty patch you might have experienced a segfault on startup when running Marble between Feb 10-13. In this case please update your SVN. It's gone now.