开发者

save file in XYZ format as vector (GML or shp)

I am using QGIS software. I would like to show value of each raster cell as label. My idea (I don't know any plugin or any functionality from QGIS which allow to 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:*

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.


yes - sorry I forgot to add such information.

In general after preparing CSV file (using gdal2xyz.py with -csv option), I need to add one line at begining of it: "Longitude,Latitude,Value" (without the quotes)

Then I need to create a VRT file which contain

*> <OGRVRTDataSource>
>     <OGRVRTLayer name="Shapefile_name">
>         <SrcDataSource>Shap开发者_高级运维efile_name.csv</SrcDataSource>
>         <GeometryType>wkbPoint</GeometryType>
> 
>         <GeometryField encoding="PointFromColumns" x="Longitude"
> y="Latitude"/>
>     </OGRVRTLayer> </OGRVRTDataSource>*

Run the command "ogr2ogr -select Value Shapefile_name.shp Shapefile_name.vrt". I got the file evap_OBC.shp and two other associated files.


For the sake of archive completeness, this question has also been asked on GDAL mailing list as thread save raster as point-vector file. It seems Chaitanya provided solution for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜