1

I'm working with QGIS 3.8 and I'm facing an error that I don't know how to fix.

I have download shapefile of all the countries in the world. When I display it on QGIS it has no problem at all: enter image description here

I wanted to edit the table of this shapefile, so I went to the attribute table, used ctrl a and ctrl c in order to copy the table and paste it in Excel. Then I have removed columns that I don't need (still have the WKT geometry, hasn't touched it), saved it as CSV and then I tried to load this layer to QGIS but I don't get all the countries, some have dissapeared even though I haven't touched them or edit them in Excel: enter image description here

I don't understand what can lead to this kind of error and why, I have uploaded many CSV geometry files after editing them, so what can cause such an error?

My end goal is to be able to edit my layer in Excel and then upload as CSV without losing polygons.

2
  • 3
    Some countries may have several thousand points on their border. The WKT geometry may be too large for a spreadsheet. Why didn't you use QGIS table view to edit data?
    – Zoltan
    Commented Mar 21, 2020 at 13:34
  • 4
    My general rule of thumb is to avoid installing Excel on the same machine as GIS data, since they are mortal enemies, along the lines of antimatter and matter, so it's only a matter of time before holes start to appear. In this case, you seem to have truncated/corrupted all the large geometries, so this is likely a field overflow issue. Try exporting only non-geometry with a key field, then importing to a new table, and using a join to pull the deltas back over.
    – Vince
    Commented Mar 21, 2020 at 13:37

1 Answer 1

4

You can not use Excel to this, because the number of characters per cell in Excel is limited to 32767 characters. See https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3.

This means Excel cuts off WKT strings which are longer and therefore become invalid.

I am not aware of another software like Excel, which does not have such a limit (maybe someone else knows?), so you need to do your stuff in QGIS or a texteditor.

Another option would be to to keep your geometries in a shapefile and create a uid which you can link to your edited csv and then combine it in QGIS by using an attribute join.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.