Results 1 to 4 of 4

Thread: Plot Raster chart background

  1. #1
    Join Date
    Apr 2008
    Posts
    53
    Thanks
    10

    Default Plot Raster chart background

    Hello,

    I am trying to load NOAA raster charts into the background of QwtPlot. I used GDAL to read the charts to create a geotiff file, so let's say I have a geotiff chart with dimensions roughly 12,000 by 8,000.

    I was thinking about using GDAL_translate to crop according to geospatial coordinates (-projwin option) and to resample according to number of pixels and lines (-outsize option) to create an image (bitmap). This is done whenever the user pans or zooms the plot, and then I would load the generated image (bitmap) in my QwtPlotItem to draw the background.

    However, then I saw the QwtRasterItem class and thought that I would be able to load the whole 12,000 by 8,000 geotiff (converted to bitmap) into a rasterData and let the rasterItem automatically re-sample and draw the background.

    Is this approach possible? And has anyone else ever had experience loading a huge background image and then resampling for the zoom/pan?

    Thank you

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Plot Raster chart background

    I have written such a raster item for geotiff maps a couple of years ago. As far as I remember we had divided our maps into tiles ( our maps were much more, than 12000x8000, but a tile was smaller ) and the most difficult thing was to put these tiles together for each image composition.

    AFAIR I had a TIFF library that offered to read the file line by line, so I didn't need to have all in memory at once. If your plot and your tiff files use the same projection all you need to do is to run over the lines in your image translate each pixel into your coordinates and pick the closest pixel from your tiff image.

    Unfortunately a lot of code that does the interaction between raster data and raster item can be found in the implementation of QwtPlotSpectrogram::renderImage instead of its base class ( where it should be ). So I'm afraif you have to copy some code, that calculates the size ( = resolution ) of the image and its position in scale coordinates.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    jmsbc (6th August 2010)

  4. #3
    Join Date
    Apr 2008
    Posts
    53
    Thanks
    10

    Default Re: Plot Raster chart background

    Yeah, there seem to be many different approaches to this problem, so I was trying to attack it using the simplest method I knew how first. In the end it would probably be a good idea for me to create tiles to be loaded from a database as well.

    Would that code that you wrote for geotiff maps happen to be publicly available?

    Thanks

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Plot Raster chart background

    No, I'm not the owner of this code.

    Uwe

Similar Threads

  1. Native vs Raster
    By ArlexBee-871RBO in forum Qt Programming
    Replies: 7
    Last Post: 15th February 2010, 22:22
  2. Replies: 3
    Last Post: 9th September 2009, 04:34
  3. Replies: 2
    Last Post: 30th June 2009, 17:08
  4. Replies: 7
    Last Post: 22nd September 2008, 22:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.