Conversion of an input map from vector to raster (QGIS)

Dear all,

I apologize in advance in case this thread is off-topic for this forum, but I'd like to know if somebody has any tips for creating the raster map to use in InVEST as an input. In fact, I normally go to the top menu and select Raster Conversion Rasterize but the raster I create seems not to be good for running a scenario with InVEST 3.3.0. I manage to use that raster as an input for the model, but I get an error when running the scenario. Does that have to do with the size of the raster I try to plug in?

Thank you in advance for your help!

Riccardo

Comments

  • jdouglassjdouglass Administrator, NatCap Staff
    Hi @RiccardoM, errors in InVEST rarely have to do with raster sizes these days.  If this error is still happening for you, could you provide the error message and your logfile?  That will help to track down the issue InVEST sees with the raster.
  • Hello!

    Thank you so much for your response. I have two questions, one concerning the size of raster maps and the other one concerning the creation of a raster map with QGIS that can be used with InVEST.

    1) I have been trying running simulations with a raster map with a size of 2.14 GB and InVEST 3.3.0 seems not to be able to finish running the simulation. I have tried with several modules and I do not get any error message, but simply the simulation is never finished and I get no output. I let the module run for one hour and after a while it seems like it's simply not progressing any further. The carbon module is an exception as with this one I managed to complete the simulation with the 2.14 GB raster map. The modules I am interested in using for my analysis and that do not seem to process my raster map are the Habitat Quality module, the SDR module, the NDR module, and the Water Yield module. Is there any maximum size you recommend for raster maps for the aforementioned modules?

    2) At the present moment I do not seem to be able to create a raster map with QGIS that works with InVEST. I'm new to QGIS and so I would be very grateful to you if you had any tips on the rasterization process. I start with a shapefile and I follow the following process: Raster Conversion Rasterize. The raster I create has 28 land cover types and in the input table I have the corresponding 28 land cover ids, but if I try to run any InVEST model I get an error message. Please find attached the log of this simulation.

    Thank you very much for your helpfulness!

    Riccardo
  • RichRich Administrator, NatCap Staff
    Hi @RiccardoM

    As for #1, 2.14 GB can be a large raster for us depending on the model.  Especially if it is a routed water model.  In some cases sizes like that may take hours to process.  Without knowing more about your particular situation, I'd assume that's what might be happening.  Any chance you could downsample the data stack just to make sure things are otherwise okay on your end?

    And for #2, I wish we'd had the model output what landcover types were missing.  Offhand I wonder if your rasterization process introduces a nodata value that's not actually mapped to a nodata value?  Anyway you can take a look at the histogram?  If you're Python saavy, this little bit of code could dump that info:

    import gdal
    import numpy
    ds=gdal.Open('landuse_90') #replace 'landuse_90' with a path to your raster
    b=ds.GetRasterBand(1)
    numpy.unique(b.ReadAsArray())
Sign In or Register to comment.