[gdal-dev] save raster as point-vector file
Chaitanya kumar CH
chaitanya.ch at gmail.com
Tue Aug 9 14:13:10 EDT 2011
Create a text file with just the header. Use the cat command to join this
file and the xyz file.
$ cat HeaderFile.csv file1.csv > file1.csv
You can repeat this on all files in a shell script.
Otherwise add the following line in the gdal2xyz.py script at line 144 .
dst_fh.write( 'Longitude,Latitude,Name' )
You will also have to create a separate vrt file for each csv file. The
SrcDataSource element value changes for each file.
2011/8/9 Mateusz Kędzior <matandked at gmail.com>
> if I understand properly, I need to add one line to each of processed
> How I can do it quickly? Is there any option in gdal2xyz.py script?
> If no - what would You recommend?
> I think about sed utility, but it's general difficult in use.
> 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.
> Best Regards,
> W dniu 9 sierpnia 2011 13:38 użytkownik Chaitanya kumar CH <
> chaitanya.ch at gmail.com> napisał:
>> gdal2xyz.py creates space delimited fields. Consider running it with the
>> -csv option to delimit it with comma.
>> 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.
>> Run ogrinfo and ogr2ogr on the .vrt file to check the file.
>> : http://www.gdal.org/ogr/drv_csv.html
>> 2011/8/9 Mateusz Kędzior <matandked at gmail.com>
>>> 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
>>> 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.
>>> unfortunately I am unable to load created file (even if I change the
>>> extension to .gml)
>>> ogr2ogr tool don't even recognize this format.
>>> Thank You in advance,
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>> Best regards,
>> Chaitanya kumar CH.
>> 17.2416N 80.1426E
Chaitanya kumar CH.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev