Results 1 to 3 of 3

Thread: Using QwtRasterData for displaying the raster data resultant from R language

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Using QwtRasterData for displaying the raster data resultant from R language

    From here:http://cran.r-project.org/web/packages/ggmap/ggmap.pdf
    ggmap plots the raster object produced by get_map.
    From: http://qwt.sourceforge.net/class_qwt_raster_data.html
    QwtRasterData defines an interface to any type of raster data
    So, following way the data resultant from get_map is saved in a rda (raster) file.

    Qt Code:
    1. mapImageData <- get_googlemap (c (lon=-74.0087986666667, lat=40.7106593333333), zoom=15)
    2. save (mapImageData, file="savedMap.rda")
    To copy to clipboard, switch view to plain text mode 

    Will it be possible for me to display that resultant raster data on QwtRasterData class?

    • What more information should I present here to know whether it can be done and how?
    • Should I present a sample of raster data?
    • Do I need to convert that raster data in a particular format before it can be loaded on the Qt widget?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using QwtRasterData for displaying the raster data resultant from R language

    QwtRasterData assumes that you have a regular matrix of data values, one for every cell in the matrix. It then maps this (x,y,z) data to a spectrogram using bilinear interpolation to create colors for the pixels between raster points. QwtRasterData doesn't display anything; QwtPlotSpectrogram does that, using the data in QwtRasterData.

    So, you need to parse the rda into a QwtRasterData structure, then decide on the color mapping to be used for displaying the spectrogram. Note that for the color mapping to work properly, you must set the z range such that min z and max z map to 0 and 1 on the color map, respectively.

    I have no idea what an rda file looks like, so you will have to determine how to parse it.

    And you probably want to use QwtMatrixRasterData; parse your rda file into a QVector< double > array of size (nRows * nCols), where each value in the vector is the value of z at that point. Use the "setValueMatrix()" and "setInterval()" methods to define the real-world x- and y-ranges of the data so the spectrogram can plot it properly.
    Last edited by d_stranz; 29th July 2012 at 17:10.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    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: Using QwtRasterData for displaying the raster data resultant from R language

    QwtRasterData assumes that you have a regular matrix of data values, one for every cell in the matrix. It then maps this (x,y,z) data to a spectrogram using bilinear interpolation to create colors for the pixels between raster points.
    This is what QwtMatrixRasterData does. QwtRasterData is simply an abstract API to bind the data ( however it looks like ) to a spectrogram.
    So, you need to parse the rda into a QwtRasterData structure, ...
    All what needs to be done is to implement the abstract methods usually fetching the values from any applications specific data structures.
    And you probably want to use QwtMatrixRasterData; parse your rda file into a QVector< double > array of size (nRows * nCols) ...
    When there is no other reason to have the values in memory this should be the easiest way to go.

    Uwe

Similar Threads

  1. Replies: 2
    Last Post: 1st April 2012, 16:33
  2. QwtRasterData and non-linearly sampled data
    By DizzyMoods in forum Qwt
    Replies: 3
    Last Post: 23rd December 2011, 11:50
  3. displaying data
    By willief in forum Newbie
    Replies: 4
    Last Post: 10th March 2011, 06:33
  4. Displaying YUV data through Phonon
    By heminm in forum Qt Programming
    Replies: 0
    Last Post: 10th October 2009, 16:16
  5. Displaying data in QTable
    By raghvendramisra in forum Qt Tools
    Replies: 1
    Last Post: 6th September 2007, 12:48

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.