Create a text file with just the header. Use the cat command to join this file and the xyz file.<br>$ cat HeaderFile.csv file1.csv &gt; file1.csv<br>You can repeat this on all files in a shell script.<br><br>Otherwise add the following line in the gdal2xyz.py script at line 144 [1].<br>
<br><span style="font-family: courier new,monospace;">dst_fh</span><span style="font-family: courier new,monospace;" class="o">.</span><span style="font-family: courier new,monospace;">write</span><span style="font-family: courier new,monospace;" class="p">(</span><span style="font-family: courier new,monospace;"> &#39;</span><span style="font-family: courier new,monospace;">Longitude,</span><span style="font-family: courier new,monospace;">Latitude,Name&#39; )</span><br>
<br>You will also have to create a separate vrt file for each csv file. The SrcDataSource element value changes for each file.<br><br>[1]: <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdal2xyz.py?rev=21127#L145">http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdal2xyz.py?rev=21127#L145</a><br>
<br><div class="gmail_quote">2011/8/9 Mateusz Kędzior <span dir="ltr">&lt;<a href="mailto:matandked@gmail.com">matandked@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Chaitanya,<br><br>if I understand properly, I need to add one line to each of processed files.<br>How I can do it quickly? Is there any option in gdal2xyz.py script?<br><br>If no - what would You recommend?<br>I think about sed utility, but it&#39;s general difficult in use.<br>

<br>When I am thinking about Python I see only one possibility - load each file to variable and then assign to another first line plus variable and at last - save it.<br><br>==============<br>Best Regards,<br>Mateusz<br>
<br>
<div class="gmail_quote">W dniu 9 sierpnia 2011 13:38 użytkownik Chaitanya kumar CH <span dir="ltr">&lt;<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>&gt;</span> napisał:<div><div></div>
<div class="h5"><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Mateusz,<br><br>gdal2xyz.py creates space delimited fields. Consider running it with the -csv option to delimit it with comma.<br>Now you can almost use it as a csv format vector file. You just need to add a header row and define a small VRT file as described in OGR&#39;s CSV driver page[1].<br>


Run ogrinfo and ogr2ogr on the .vrt file to check the file.<br><br>[1]: <a href="http://www.gdal.org/ogr/drv_csv.html" target="_blank">http://www.gdal.org/ogr/drv_csv.html</a><br><br><div class="gmail_quote"><div><div></div>

<div>2011/8/9 Mateusz Kędzior <span dir="ltr">&lt;<a href="mailto:matandked@gmail.com" target="_blank">matandked@gmail.com</a>&gt;</span><br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div><div>Hello,<br> <br>I would like to show value of each raster cell as label. My idea (I don&#39;t know any plugin or any functionality in GDAL/OGR which allow to do it easier) is to export raster using gdal2xyz.py into coordinates-value format and then save it as vector (GML or shapefile). For this second task, I try to use <br>



=================================================================================================================================================<br>gdal_polygonize.py:<br>gdal_polygonize.py rainfXYZ.txt rainf.shp Creating output rainf.shp of format GML. 0...10...20...30...40...50...60...70...80...90...100 - done.<br>



=================================================================================================================================================<br>unfortunately I am unable to load created file (even if I change the extension to .gml)<br>



ogr2ogr tool don&#39;t even recognize this format.<br> <br>=========================<br>Thank You in advance,</div>
<div>Mateusz</div>
<br></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Best regards,<br>

Chaitanya kumar CH.<br>
<br><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>17.2416N 80.1426E<br>
</font></blockquote></div></div></div><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>