Mateusz,<br><br>Refer to OGR's VRT format driver page.<br><a href="http://www.gdal.org/ogr/drv_vrt.html">http://www.gdal.org/ogr/drv_vrt.html</a><br><br><div class="gmail_quote">2011/8/11 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 Chaitanya,<br><br>I try to add full path to csv file - is it correct?<br><br>===================================================NEW VRT FILE====================================<br>
<OGRVRTDataSource><br> <OGRVRTLayer name="evap_OBCXYZn"><br>
<SrcDataSource>"/media/windows/studia/2_sem_mgr/mgr/prof_Zawadzki/dods/gldas/00Z07Apr2009_00Z15Apr2009/evap_OBCXYZn.csv"</SrcDataSource><div class="im"><br> <GeometryType>wkbPoint</GeometryType><br>
<LayerSRS>WGS84</LayerSRS><br> <GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/><br> </OGRVRTLayer><br></OGRVRTDataSource><br>
</div>
================================================================================================<br><br>When I try use ogrinfor I get an error message:<br><br>FAILURE:<br>Unable to open datasource `evap_OBCXYZn.vrt' with the following drivers.<br>
<br>When I use the same tool at csv file I get:<br><br>=================================<br><br>INFO: Open of `evap_OBCXYZn.csv'<br> using driver `CSV' successful.<br>1: evap_OBCXYZn (None)<br><br>================================<br>
<br>The CSV file contain such information:<br><br>============================<br>Longitude,Latitude,Name<br>20.132145,52.4227439,1.78132e-05<br>20.382145,52.4227439,1.89083e-05<br>...<br>and so on..<br>============================<br>
<br>How I can change it to get vector-point layer? As I wrote I can only get a layer without geometry if I point to csv file.<br><br>============<br>Best regards,<br>Mateusz<br><br><br><br><div class="gmail_quote">W dniu 11 sierpnia 2011 10:04 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 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;">What is the output of ogrinfo on the .vrt file?<div><div></div><div><br><br><div class="gmail_quote">
2011/8/11 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;">
Hi Chaitanya,<br><br>I say that I don't need to create VRT file, but I was wrong. When I try to run ogr2ogr utility:<br><i><br>ogr2ogr -f GML output_file.gml input_file.csv</i><br><br>I discover that created file contain only table - if I choose ESRI shapefile as output, I get only dbf file.<br>
<br>So i try to generate such file:<br><br>================================================================================<br><OGRVRTDataSource><br> <OGRVRTLayer name="evap_OBC_OBCXYZn"><br> <SrcDataSource>evap_OBC_OBCXYZn.csv</SrcDataSource><div>
<br>
<GeometryType>wkbPoint</GeometryType><br> <LayerSRS>WGS84</LayerSRS><br> <GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/><br>
</OGRVRTLayer><br></OGRVRTDataSource><br></div>=================================================================================<br><br>but:<br><ul><li>if I type .vrt file as input I get an empty GML file</li>
<li>
if I I type .csv file as input I get an output which contain only table (without geometry)</li></ul>How I can run it properly?<br>Which values are allowed in <GeometryField encoding> property?<br>===================<br>
Best regards,<br>Mateusz<br><br><div class="gmail_quote">W dniu 10 sierpnia 2011 05:58 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>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.<div><div></div><div><br>
<br><div class="gmail_quote">2011/8/10 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;">
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>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><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><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>17.2416N 80.1426E<br>
</div></div></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></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>