国際的にはUTF8を標準の文字エンコードとして取り扱う動きを見せて居る。併し、日本の行政が公表するシェープファイルは、専らシフトJISでエンコードされて居る。其儘のシェープファイルをGISソフトに読み込むと文字化けする可能性が有る。是を回避すべく、此の企画は各シェープファイルにコードページファイルを追加するバッシュ/パワーシェル・スクリプトを提供する。
キーワード:地理情報システム(GIS)、ArcGIS、QGIS、文字エンコード、シフトJIS(SJIS)、シェープファイル(.shp)、コードページファイル(.cpg)、バッシュ(.sh、.bash)、パワーシェル(.pwsh)、コマンドプロンプト(.dat)。
- バッシュ・スクリプト(上書を許可)
- バッシュ・スクリプト(上書を禁止)
- パワーシェル・スクリプト(上書を許可)
- パワーシェル・スクリプト(上書を禁止)
- コマンドプロンプト・スクリプト(上書を許可)
- コマンドプロンプト・スクリプト(上書を禁止)
リンクをクリックすると、最新版のスクリプトがブラウザーに表示されます。ブラウザーの機能で保存して下さい(通常のショートカットキー:Ctrl/Cmd + S)。或いは、リンクをコピーして、バッシュではcurl --output $出力ファイル $リンク、パワーシェルではInvoke-WebRequest -OutFile $出力ファイル -Uri $リンクを実行して保存できます。但し、$出力ファイルは保存先のファイルへのパスに、$リンクはコピーしたリンクに置き換えて下さい。
SHAPEFILE_ENCODING/ シェープファイルの文字エンコード
├── Sources/
│ └── ShiftJIS/ 文字エンコードをシフトJISに設定する
│ ├── overwrite.dat コマンドプロンプト・スクリプト(上書を許可)
│ ├── overwrite.sh バッシュ・スクリプト(上書を許可)
│ ├── overwrite.ps1 パワーシェル・スクリプト(上書を許可)
│ ├── preserve.dat コマンドプロンプト・スクリプト(上書を禁止)
│ ├── preserve.sh バッシュ・スクリプト(上書を禁止)
│ └── preserve.ps1 パワーシェル・スクリプト(上書を禁止)
├── license.md MITライセンス
└── readme.md 説明書
We are internationally moving toward UTF-8 as the standard character encoding. Yet, shapefiles published by Japanese government agencies are encoded exclusively in Shift JIS. If GIS software loads such shapefiles, text may become garbled. To prevent it, this project provides Bash/PowerShell scripts that add a code page file to each shapefile.
Keywords: Geographic Information System (GIS), ArcGIS, QGIS, Character Encoding, Shift JIS (SJIS), Shapefile (.shp), Code Page File (.cpg), Bash (.sh、.bash), PowerShell (.pwsh), and Command Prompt (.dat).
- Bash Script (Allow Overwriting)
- Bash Script (Prohibit Overwriting)
- PowerShell Script (Allow Overwriting)
- PowerShell Script (Prohibit Overwriting)
- Command Prompt (Allow Overwriting)
- Command Prompt (Prohibit Overwriting)
Click the link to display the latest version of the script on browser. Save it using the browser's function (common shortcut key: Ctrl/Cmd + S). Alternatively, copy the link and execute curl --output $outfile $link in Bash or Invoke-WebRequest -OutFile $outfile -Uri $link in PowerShell, replacing $outfile with the path to the file where you would like to save it and $link with the link you copied earlier.
SHAPEFILE_ENCODING/ Shapefile Character Encoding
├── Sources/
│ └── ShiftJIS/ Set character encoding to ShiftJIS
│ ├── overwrite.dat Command Prompt (Allow Overwriting)
│ ├── overwrite.sh Bash Script (Allow Overwriting)
│ ├── overwrite.ps1 PowerShell Script (Allow Overwriting)
│ ├── preserve.dat Command Prompt (Prohibit Overwriting)
│ ├── preserve.sh Bash Script (Prohibit Overwriting)
│ └── preserve.ps1 PowerShell Script (Prohibit Overwriting)
├── license.md MIT License
└── readme.md Manual