Skip to content

geojson2shp character encoding, with ogr2ogr #1

@iott

Description

@iott

1. 问题描述

开发中有个需求把geojson文件转化为shp文件,其中的属性值为中文,通过ogr2ogr转换的结果查看发现乱码,然后各种查询和搜索最终得以解决

1.1设置编码前的操作命令如下:

ogr2ogr -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson

1.2 设置编码的操作命令如下:

ogr2ogr --config SHAPE_ENCODING "UTF-8" -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson
or
ogr2ogr --config SHAPE_ENCODING "UTF-8" -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions