Hello all, for the last few days I have been dealing with large to very
large DEM for Spain, as a source of survey-grade quality data was released
some time ago, and I took the time to create a 25x25-meter resolution for
all mainland Spain, which is about 500.000 square kilmeters in area. The
resulting file is some 700 MB in size, and has 52786x30003 pixels.

First, the good news. QLGT does a great job handling such a big file. It
doesn't crash, it has some code there to avoid taking too long processing
the DEM (IIRC, skips processing it if viewport needs more than 10000x10000
points), and when the DEM is set to "none" (instead of "shading" or
"contour"), QLGT works as fast as without the DEM loaded for any zoom level.

Now, the improvement I think would be reasonably easy to implement, and
which would allow QLGT to deal with showing DEM at any zoom level with
little additional processing needed, enhancing the end user experience
(redrawing the screen would be dramatically reduced). GeoTiff files can have 
an arbitrary number of overview images in them, which are smaller versions
of the original file. If QLGT could be adapted to look at the GeoTiff file
looking for the available overviews, and use the smallest one that covers
the viewport to be drawn, if the DEM is created with (or modified to
include) scaled overviews, users could have the option to leave the DEM
visible on screen at all zoom levels, with little effect on UI reponse times.

This is how a GeoTiff DEM with several overview images look like:

$ gdalinfo mainland_balearic/mainland_balearic_dem.tiff 
Driver: GTiff/GeoTIFF
Files: mainland_balearic/mainland_balearic_dem.tiff
Size is 52786, 30003
Coordinate System is:
GEOGCS["unnamed ellipse",
    DATUM["unknown",
        SPHEROID["unnamed",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
Origin = (-9.448178185470384,43.906719781655518)
Pixel Size = (0.000269437866598,-0.000269437866598)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  -9.4481782,  43.9067198) (  9d26'53.44"W, 43d54'24.19"N)
Lower Left  (  -9.4481782,  35.8227755) (  9d26'53.44"W, 35d49'21.99"N)
Upper Right (   4.7743690,  43.9067198) (  4d46'27.73"E, 43d54'24.19"N)
Lower Right (   4.7743690,  35.8227755) (  4d46'27.73"E, 35d49'21.99"N)
Center      (  -2.3369046,  39.8647476) (  2d20'12.86"W, 39d51'53.09"N)
Band 1 Block=2048x2048 Type=Int16, ColorInterp=Gray
  Overviews: 13197x7501, 6599x3751, 3300x1876


Those overviews were added to the DEM after being created, and increased the 
file size from 704392704 to 1055199158 bytes, although increases in size will 
depend on the number and sizes of the overviews. But I think that from the
point of view of the user, hard drive space is affordable, but an unresponsive 
UI is unacceptable. Sure, the user can be told to just hide the DEM,
although it will be there an usable, but they will demand their nice
mountain shadings.


I _believe_ that changes needed to QLGT shouldn't be very intrusive or
complex, but I can only guess, as my coding skills are next to null, and by
reading the code I can only have a general impression on how it works. The
constructor for CMapDEM (CMapDEM.cpp) should be change, to include code to
make use of GDAL C++ binding functions GDALGetOverviewCount and GDALGetOverview 
and create a list of "bands", instead of a single band for the "main" file.
And then (if the API for the rest of the application can stay the same),
under CMapDEM::draw some logic should be implemented to always choose the
best overview, according to the viewport map coordinates.

I can't explain it better, but I hope someone has understood it. I'm sure I
have missed a lot of internal API dependencies and the change, which seems
conceptually simple, is harder once you try to implement it. But maybe
there is someone out there that would like to have a look at it, provided I
am perfectly aware this is not exactly a top priority, and though it may
help for some people, it may not be worth the effort.

By the way, the GDAL command to add overviews to an existing GeoTiff is
"gdaladdo", well documented in the man page. And if there is interest, I
can provide a DEM for the Canary Islands including overviews (at a size of
less than 20 MB, it is easy to make it available, although large enough to
make rendering at low zooms noticeably slower).

Hope it helps.

-- 
Jose Luis Domingo Lopez
Linux Registered User #189436     Linux Kubuntu 11.10 (Linux 
3.0.0-16-generic-pae)

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to