This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

Habitat Risk Assessment - Error : " WARNING 'NoneType' object has no attribute 'GetEnvelope' "

Hello!

I am receiving the error "WARNING  'NoneType' object has no attribute 'GetEnvelope", when I run the Habitat Risk Assessment with a particular layer.

The model works fine without the offending layer, and when add the layer to the folder "\Input\StressorLayers\" it work normally as well. However, then I put a copy of it in the folder: \Input\Spatially_Explicit_Criteria\Exposure\", the error occures. This layer has the column "rating" (as an integer) and it is populated with the default class ranges of 1 to 3.

I have attached the out put log for viewing.

I had a look around and with ref to the below link this error seems to be related to the software not determine the layer extent:
# Get Envelope returns a tuple (minX, maxX, minY, maxY)
env = geom.GetEnvelope()

So, I trying to find any errors in the initial Shapefile or when/where it goes wrong in the intermidiate files.

It anyone can give some advise, I would be most grateful.

Cheers,

Comments

  • Hi there, 

    Thanks for your question.  It sounds like you've already done some problem solving; thanks for sharing what you've tried so far.  

    I'm not exactly sure what's happening here, but have a couple of ideas to try.  First, have you double checked the projection to ensure it matches your other data?  Another idea is to also add attributes for "DQ" and "Weight," even if they all have the same score. Let me know if either of these small hacks work.  You're welcome to also send me your offending data layer and I can see if I can get it to cooperate.  

    - Katherine 
    kwyatt@stanford.edu  
  • jdouglassjdouglass Administrator, NatCap Staff
    Hey, sorry to chime in here, but `NoneType` exceptions often happen when InVEST (via GDAL) can't properly open a spatial input to the model.  In case this is the issue, would you mind attaching the logfile from your model run to this issue so we can take a look?   Thanks!
  • Hello Katherine and jdouglass,

    Thank you both for the support.

    Katherine, the layer is the same "EPSG:3577" coordinate referance system as all the other ones layers. However, I
    am not sure that you are refering to: I have the "DG" and "Weight" assured in the "<habitat layer>+"_ratings.csv"  file in the "\habitat_stressor_ratings\" folder.

    jdouglass, I have attached the log file.

    Cheers,




  • jdouglassjdouglass Administrator, NatCap Staff
    Hmm ... well, according to the logfile, HRA ran through successfully!  Did the UI show a green box on the model's run dialog, or was there a a red error box when the 'GetEnvelope' error happened?
  • Thanks of the response jdouglass. The green box appears with "model completed successfully" appears, and also the resultant "intermediate" and "output" rasters do not produce unexpected results. So, to me, the model seems to have worked. Still, I need to envestigate this a bit further.




  • Hi Katherine and  jdouglass,

    Solved!

    I have been away since my last post. However, as always, after walking away for a problem, you return to it all a freash.
    The solution was super simple and I am a tad embarressed to said that I just clipped the Shapefile by my study area extent Shapefile and used that in the Spatially_Explicit_Criteria" folder, and the errors did not occur. I have no idea why I did not do this in the first place... I presume that this determined the extent envolope that was need.

    Thanks again for your help.

    Cheers,

    Loewenthal
Sign In or Register to comment.