Код: Выделить всё
ogr2ogr -lco ENCODING=UTF-8 output.shp input.vrt
Код: Выделить всё
ogr2ogr -lco ENCODING=WIN-1251 output.shp input.shp
Если
Код: Выделить всё
ogr2ogr output.shp input.shp
Как же решить задачу? И если можно, пакетный вариант.
Геоинформационные системы (ГИС) и Дистанционное зондирование Земли
Код: Выделить всё
ogr2ogr -lco ENCODING=UTF-8 output.shp input.vrt
Код: Выделить всё
ogr2ogr -lco ENCODING=WIN-1251 output.shp input.shp
Код: Выделить всё
ogr2ogr output.shp input.shp
ogr2ogr -lco ENCODING=UTF8 --config SHAPE_ENCODING CP1251 output.shp input.shp
Shape: DBF Codepage = CP1251 for Testshp1251.shp
Shape: Treating as encoding 'CP1251'.
GDAL: GDALOpen(Testshp1251.shp, this=0x21f3e20) succeeds as ESRI Shapefile.
GDAL: GDALDriver::Create(ESRI Shapefile,TestshpUTF8_3.shp,0,0,0,Unknown,(nil))
Shape: DBF Codepage = UTF-8 for TestshpUTF8_3.shp
Shape: Treating as encoding 'CP1251'.
OGR2OGR: 3 features written in layer 'TestshpUTF8_3'
GDAL: GDALClose(TestshpUTF8_3.shp, this=0x21f3620)
Shape: 3 features read on layer 'Testshp1251'.
GDAL: GDALClose(Testshp1251.shp, this=0x21f3e20)
Осталось только файлик CPG размножить с соответсвующими именами на все ваши данные - т.к. его содержимое не меняется.Shape: DBF Codepage = CP1251 for Testshp1251.shp
Shape: Treating as encoding 'CP1251'.
GDAL: GDALOpen(Testshp1251.shp, this=0x163ee00) succeeds as ESRI Shapefile.
GDAL: GDALDriver::Create(ESRI Shapefile,TestshpUTF8.shp,0,0,0,Unknown,(nil))
Shape: DBF Codepage = UTF-8 for TestshpUTF8.shp
Shape: Treating as encoding 'UTF-8'.
SHAPE: Extending field 1 (Nametext) from 20 to 29 characters
OGR2OGR: 3 features written in layer 'TestshpUTF8'
GDAL: GDALClose(TestshpUTF8.shp, this=0x163e600)
Shape: 3 features read on layer 'Testshp1251'.
GDAL: GDALClose(Testshp1251.shp, this=0x163ee00)
Код: Выделить всё
ogr2ogr 1\arc\popnt.shp F:\public\ArcGIS\TOPO300K.gdb poppnt_1mln -lco encoding=1251
Код: Выделить всё
ogr2ogr -f "Mapinfo File" 1\arc\popnt.mif 1\arc\popnt.shp -lco encoding=1251
а gdb вообще огромный.ogr2ogr -sql "select * from poppnt_1mln where fid<10" 1\arc\poppnt_test.shp 1\arc\poppnt_1mln.shp -lco encoding=1251
Код: Выделить всё
ogr2ogr -lco ENCODING=UTF-8 output2.shp poppnt_test.shp --config CPL_DEBUG ON
Код: Выделить всё
ogr2ogr -f "MapInfo File" output3.mif output2.shp
ogr2ogr использует метод getrawfield - т.е. как выдает драйвер. В случае шейпа - он выдает в кодировке - мифа - нет.maks24 писал(а): Странно, но преобразование mif-mif происходит удачно с кодировкой 1251.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость
© GIS-Lab и авторы, 2002-2017. При использовании материалов сайта, ссылка на GIS-Lab и авторов обязательна. Содержание материалов - ответственность авторов (подробнее).