og2ogr字符编码问题


10

当我溶解shapefile时:

ogr2ogr "b:\out.shp" "b:\Tele.shp" -dialect sqlite -sql "SELECT ST_Union(geometry), nev, jar FROM Tele GROUP BY jar" 

我收到如下错误消息:

警告1:一个或几个字符无法从UTF-8正确转换为ISO-8859-1。

我不明白,因为Tele.cpg包含“ UTF-8”

尝试此操作时:

ogr2ogr "b:\out.shp" "b:\Tele.shp" -dialect sqlite -sql "SELECT ST_Union(geometry), nev, jar FROM Tele GROUP BY jar" ENCODING=UTF-8

错误消息是:

警告1:结合-sql忽略层名称。错误1:无法创建字段名称“ nev”:无法转换为“ UTF-8”

那么我该怎么做才能保留我奇怪的匈牙利字符?

Answers:


9

-lcoENCODING=UTF-8零件前键入,又名-lco ENCODING=UTF-8,它应该可以工作(这对我和我奇怪的波兰字符都起作用)。


它会在.shp文件旁边创建一个.cpg文件,在QGIS中,我注意到我仍然必须在属性表的属性中将编码从'System'更改为'UTF-8'才能正确显示字符。
西尔维亚·H
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.