Mateusz,<br><br>You have to change the OGRVRTLayer name property to point to the file name without the extension. Also change the SrcDataSource element.<br><br>FYI, this process creates a vector file with points. gdal_polygonize produces polygons.<br>
<br><div class="gmail_quote">2011/8/10 Mateusz Kędzior <span dir="ltr"><<a href="mailto:matandked@gmail.com">matandked@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi again,<br><br>is it mandatory to create such file?<br>Regarding to information on GDAL/OGR page should I create simple text file which contains only other OGRVRTLayer name property :<br><br><pre><OGRVRTDataSource>
<OGRVRTLayer name="test">
<SrcDataSource>test.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/>
</OGRVRTLayer>
</OGRVRTDataSource></pre>==============<br>Best regards,<br>Mateusz<br><br><div class="gmail_quote">W dniu 9 sierpnia 2011 20:13 użytkownik Chaitanya kumar CH <span dir="ltr"><<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>></span> napisał:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Create a text file with just the header. Use the cat command to join this file and the xyz file.<br>
</div>$ cat HeaderFile.csv file1.csv > file1.cHi sv<div><div></div><div class="h5"><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;">.</span><span style="font-family: courier new,monospace;">write</span><span style="font-family: courier new,monospace;">(</span><span style="font-family: courier new,monospace;"> '</span><span style="font-family: courier new,monospace;">Longitude,</span><span style="font-family: courier new,monospace;">Latitude,Name' )</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" target="_blank">http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdal2xyz.py?rev=21127#L145</a><div>
<div></div><div><br>
<br><div class="gmail_quote">2011/8/9 Mateusz Kędzior <span dir="ltr"><<a href="mailto:matandked@gmail.com" target="_blank">matandked@gmail.com</a>></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'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"><<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>></span> napisał:<div><div></div>
<div><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'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"><<a href="mailto:matandked@gmail.com" target="_blank">matandked@gmail.com</a>></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'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'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><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>17.2416N 80.1426E<br>
</div></div></div></div></blockquote></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>