TransWikia.com

How do I create/find .cpg files after creating a shapefile in QGIS?

Geographic Information Systems Asked by bird0507 on May 30, 2021

I’ve been asked to map an area of land using QGIS, so I created a new vector layer polygon and saved it to my PC without problems.

They’ve asked for the following files: .shp, .shx, .dbf, .prj and .cpg.

When I go to the folder containing my saved polygon files, all files except .cpg are there.

How do I create a .cpg file for my polygon?

3 Answers

The .cpg file is optional.

It is used to specify the code page (only for .dbf) for identifying the character encoding to be used (for example to encode utf-8).

It should not be a problem for the one who gets the shapefile to open it without .cpg-file

For further information https://en.wikipedia.org/wiki/Shapefile

But if you really need that file. just open a texteditor and write "UTF-8" into the first line and save it as "shapefilename.cpg"

Correct answer by DirkB. on May 30, 2021

In the 'Save As' window select 'UTF-8'as Encoding.

Answered by user144423 on May 30, 2021

A quick update to the answer. You may find that your data haven't been saved in UTF-8. You will need to use a different code in the cpg file.

For example, Latin-9 requires the code ISO 88591 instead. Just that, one small line of text at the top of a text file. The encoding of this text file (the cpg file) can be UTF-8 or whatever the OS prefers.

QGIS doesn't need the cpg file and works out for itself what the dbf file's encoding is.

Answered by mercergeoinfo on May 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP