[gdal-dev] save raster as point-vector file

Chaitanya kumar CH chaitanya.ch at gmail.com
Sat Aug 13 02:05:57 EDT 2011


Mateusz,

This is what I did to process evap_OBC.asc ...

1. Run the command "gdal2xyz.py -csv evap_OBC.asc evap_OBC.csv". I got a csv
file.
2. Edited the file evap_OBC.csv to add the line "Longitude,Latitude,Value"
(without the quotes) at the beginning.
3. Created a file named evap_OBC.vrt with the following content...
<OGRVRTDataSource>
    <OGRVRTLayer name="evap_OBC">
        <SrcDataSource>evap_OBC.csv</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding="PointFromColumns" x="Longitude"
y="Latitude"/>
    </OGRVRTLayer>
</OGRVRTDataSource>
4. Run the command "ogr2ogr -select Value evap_OBC.shp evap_OBC.vrt". I got
the file evap_OBC.shp and two other associated files.

In step 3, if I wanted to mention the absolute path instead of the relative
path of the file 'evap_OBC.csv', I would have added the attribute
'relativeToVRT=0' to the SrcDataSource element like so.
<SrcDataSource relativeToVRT="0">evap_OBC.csv</SrcDataSource>

2011/8/13 Mateusz Kędzior <matandked at gmail.com>

> Hi Chaitanya,
>
> I send only raster (without XYZ data).
>
> =========
> Best regards,
> Mateusz
>
> W dniu 12 sierpnia 2011 16:02 użytkownik Chaitanya kumar CH <
> chaitanya.ch at gmail.com> napisał:
>
> Mateusz,
>>
>> Send me a couple of your raster files. I'll process them and create a
>> step-by-step instructions including all the scripts I used.
>>
>>
>> 2011/8/12 Mateusz Kędzior <matandked at gmail.com>
>>
>>> Hi Chaitanya,
>>>
>>> but there is no example with CSV file stored in local hard disc.
>>> I see an example with shp file - there is no full path to it...
>>> but as I tell, when I leave only filename of CSV and use ogrinfo tool on
>>> such VRT file, I get information about empty file without any geometry or
>>> tables on it.
>>>
>>> ==========
>>> Best regards,
>>> Mateusz
>>>
>>>
>>>
>>>> Mateusz,
>>>>
>>>> Refer to OGR's VRT format driver page.
>>>> http://www.gdal.org/ogr/drv_vrt.html
>>>>
>>>>
>>>
>>
>>
>> --
>> Best regards,
>> Chaitanya kumar CH.
>>
>> +91-9494447584
>> 17.2416N 80.1426E
>>
>
>


-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110813/fbf48294/attachment-0001.html


More information about the gdal-dev mailing list