<div dir="ltr"><div>Hi Saber,<br></div><div>The code does not want long shapefile filename - so I rename my shapefile. I also modifed the argument not to take the whole directory but specific files. Since my raster data are in ENVI format, it throws an error when the code reads the .hdr files.</div>

<div><br></div><div>This is my new argument that I executed in OSGeo4W shell:</div><div><br></div><div><div>E:\Test_modis>python extract_values.py -c pts.shp 2013041 2013049 2013057 2013065 2013073</div></div><div><br>

</div><div>But it still throw an error message. When I look at the attribute table of the pts.shp it created new fieldnames based on raster filename but all the values are NULL.</div><div><br></div><div>Thanks,</div><div>

-Leo</div><div><br></div><div>this is the error message that I got:</div><div><br></div><div><div>E:\Test_modis>python extract_values.py -c pts.shp 2013041 2013049 2013057 201306</div><div>5 2013073</div><div>Found GDAL version: 1.10.1</div>

<div><br></div><div>ERROR 4: `pts.shp' not recognised as a supported file format.</div><div><br></div><div>Unable to open shapefile -c</div><div><br></div><div>E:\Test_modis>python extract_values.py pts.shp 2013041 2013049 2013057 2013065 2</div>

<div>013073</div><div>Found GDAL version: 1.10.1</div><div><br></div><div>[                                                                   ] \   0.1%Tr</div><div>aceback (most recent call last):</div><div>  File "extract_values.py", line 411, in <module></div>

<div>    inFeat.SetField( shortName, value )</div><div>  File "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\ogr.py", line 2572, in</div><div>SetField</div><div>    return _ogr.Feature_SetField(self, *args)</div>

<div>NotImplementedError: Wrong number of arguments for overloaded function 'Feature_</div><div>SetField'.</div><div>  Possible C/C++ prototypes are:</div><div>    SetField(OGRFeatureShadow *,int,char const *)</div>

<div>    SetField(OGRFeatureShadow *,char const *,char const *)</div><div>    SetField(OGRFeatureShadow *,int,int)</div><div>    SetField(OGRFeatureShadow *,char const *,int)</div><div>    SetField(OGRFeatureShadow *,int,double)</div>

<div>    SetField(OGRFeatureShadow *,char const *,double)</div><div>    SetField(OGRFeatureShadow *,int,int,int,int,int,int,int,int)</div><div>    SetField(OGRFeatureShadow *,char const *,int,int,int,int,int,int,int)</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 9:19 AM, Leo Kris Palao <span dir="ltr"><<a href="mailto:lk.palao@gmail.com" target="_blank">lk.palao@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Saber,<div><br></div><div>Have you tried to use the tool before that you suggested me <a href="http://gis-lab.info/qa/extract-values-rasters-eng.html" target="_blank">http://gis-lab.info/qa/extract-values-rasters-eng.html</a> . I tried to run it but I get an error message - I think I got the input-output argument right. Can you help me debug it?</div>


<div><br></div><div>I am running it in five MODIS-EVI dataset first for testing. I am using QGIS 2.2 with GDAL and GDAL-Python installed using OSGeo4W installer. and I am using Windows 7 64 bit professional OS. I have the extract_values.py script, rasters, and shapefile in one folder.<br>



</div><div><br></div><div>Thanks,</div><div>-Leo</div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">GDAL 1.10.1, released 2013/08/26</span><br style="font-family:arial,sans-serif;font-size:13px">


<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">C:\>cd F:\MODIS_Historical\First_</span><span style="font-family:arial,sans-serif;font-size:13px">season\yr2012\h27v07\Test</span><br style="font-family:arial,sans-serif;font-size:13px">


<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">C:\>F:</span><br style="font-family:arial,sans-serif;font-size:13px"><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">F:\MODIS_Historical\First_</span><span style="font-family:arial,sans-serif;font-size:13px">season\yr2012\h27v07\Test></span><span style="font-family:arial,sans-serif;font-size:13px">extract_values.py -c GT_and_</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">farmsurvey_modis.shp -d F:\MODIS_Historical\First_</span><span style="font-family:arial,sans-serif;font-size:13px">season\yr2012\h27v07\Test</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">Traceback (most recent call last):</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">  File "F:\MODIS_Historical\First_</span><span style="font-family:arial,sans-serif;font-size:13px">season\yr2012\h27v07\Test\</span><span style="font-family:arial,sans-serif;font-size:13px">extract_values.py",</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">line 34, in <module></span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">    import gdal, ogr, osr</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">  File "C:\OSGeo4W\apps\Python27\lib\</span><span style="font-family:arial,sans-serif;font-size:13px">site-packages\gdal.py", line 2, in <module></span><br style="font-family:arial,sans-serif;font-size:13px">


<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">    from osgeo.gdal import deprecation_warn</span><br style="font-family:arial,sans-serif;font-size:13px">

<span style="font-family:arial,sans-serif;font-size:13px">  File "C:\OSGeo4W\apps\Python27\lib\</span><span style="font-family:arial,sans-serif;font-size:13px">site-packages\osgeo\__init__.</span><span style="font-family:arial,sans-serif;font-size:13px">py", line 21,</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">in <module></span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">    _gdal = swig_import_helper()</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">  File "C:\OSGeo4W\apps\Python27\lib\</span><span style="font-family:arial,sans-serif;font-size:13px">site-packages\osgeo\__init__.</span><span style="font-family:arial,sans-serif;font-size:13px">py", line 17,</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">in swig_import_helper</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">    _mod = imp.load_module('_gdal', fp, pathname, description)</span><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">ImportError: DLL load failed: %1 is not a valid Win32 application.</span><br style="font-family:arial,sans-serif;font-size:13px"><br style="font-family:arial,sans-serif;font-size:13px">


<span style="font-family:arial,sans-serif;font-size:13px">F:\MODIS_Historical\First_</span><span style="font-family:arial,sans-serif;font-size:13px">season\yr2012\h27v07\Test></span><br></div></div><div class="gmail_extra">


<br><br><div class="gmail_quote"><div class="">On Wed, Jun 4, 2014 at 3:32 PM, Saber Razmjooei <span dir="ltr"><<a href="mailto:saber.razmjooei@lutraconsulting.co.uk" target="_blank">saber.razmjooei@lutraconsulting.co.uk</a>></span> wrote:<br>


</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple">

<div><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Have you tried this:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="http://gis-lab.info/qa/extract-values-rasters-eng.html" target="_blank">http://gis-lab.info/qa/extract-values-rasters-eng.html</a><u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Cheers,<u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Saber<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>


<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif"> <a href="mailto:qgis-user-bounces@lists.osgeo.org" target="_blank">qgis-user-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:qgis-user-bounces@lists.osgeo.org" target="_blank">qgis-user-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Leo Kris Palao<br>


<b>Sent:</b> 04 June 2014 06:50<br><b>To:</b> QGIS Mailing List<br><b>Subject:</b> [Qgis-user] Share Python Script for Point Analyses Tool<u></u><u></u></span></p><div><div><p class="MsoNormal"><u></u> <u></u></p>
<div><div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Hi QGIS Users,<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I am processing multi-temporal EVI data derived from MODIS, and the number of datasets could be around 70 images. I have points and want to extract pixel values from those points. I know that the Point Analyses Tool can do it. However, it is cumbersome to load all the MODIS data because it takes too long. Is there a way to extract the pixel values from points without actually loading the datasets? Maybe a script (GDAL or Python) can do this. Can somebody help me or point me to the right blog or website where I can use as reference.<u></u><u></u></p>


</div><p class="MsoNormal" style="margin-bottom:12pt">Thanks in advance for the help.<u></u><u></u></p></div><p class="MsoNormal">-Leo<u></u><u></u></p></div></div></div></div>
<br><br>
<hr>
<p style="font-family:arial,sans-serif;font-size:10px;color:rgb(153,153,153)">This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.</p>



<p style="font-family:arial,sans-serif;font-size:10px;color:rgb(153,153,153)">Whilst reasonable care has been taken to avoid virus transmission, no responsibility for viruses is  
 taken and it is your responsibility to carry out such checks as you feel appropriate.</p>
<p style="font-family:arial,sans-serif;font-size:10px;color:rgb(153,153,153)">If this email contains a quote or offer to sell products, carry out work or perform services then our <a href="http://www.lutraconsulting.co.uk/downloads/Lutra%20Consulting%20Standard%20Terms%20and%20Conditions.pdf" target="_blank">standard terms and conditions</a> shall apply unless explicitly stated otherwise.</p>



<p style="font-family:arial,sans-serif;font-size:10px;color:rgb(153,153,153)">Saber Razmjooei and Peter Wells trading as Lutra Consulting.</p>
<br>

<br></div></blockquote></div></div></div><span class=""><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div><div dir="ltr" style="font-family:arial;font-size:small"><div><b>LEO KRIS MARIANO PALAO</b></div>

<div>Social Sciences Division</div>
<div>International Rice Research Institute<br>Website: <a href="http://www.irri.org/" style="color:rgb(17,85,204)" target="_blank">www.irri.org</a><div>Mobile #: <font color="#1155cc">0932-847-6644</font></div></div></div>


</div><input type="hidden"><input type="hidden"><div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div><div dir="ltr" style="font-family:arial;font-size:small"><div><b>LEO KRIS MARIANO PALAO</b></div><div>Social Sciences Division</div><div>International Rice Research Institute<br>

Website: <a href="http://www.irri.org/" style="color:rgb(17,85,204)" target="_blank">www.irri.org</a><div>Mobile #: <font color="#1155cc">0932-847-6644</font></div></div></div></div><input type="hidden"><input type="hidden"><div>

</div></div>
</div></div>