5

I am fairly new to QGIS. I am attempting to import a CSV file with lat/long coordinates into a project I have been working on. Each time I import the file, I receive an error stating my geometry is invalid. I did some research, and found that as I am working on a mac, it was important to save the file as a windows formatted CSV. This has not helped. I also tried separating the columns such that the lat/longs were formatted differently, and did not include letters. This has also not worked either. I've tried to upload some images but unfortunatly i have very poor internet in the area in which I work. Can anyone help me out here?

Errors in file /Users/coreydickinson/Documents/Uganda/ICS Hybrid Inventory 2.csv
4 records discarded due to missing geometry definitions
184 records discarded due to invalid geometry definitions
The following lines were not loaded into QGIS due to errors:
Invalid X or Y fields at line 3
Invalid X or Y fields at line 4
Invalid X or Y fields at line 5
Invalid X or Y fields at line 6
Invalid X or Y fields at line 7
Invalid X or Y fields at line 8
Invalid X or Y fields at line 9
Invalid X or Y fields at line 10
Invalid X or Y fields at line 11
Invalid X or Y fields at line 12
Invalid X or Y fields at line 13
Invalid X or Y fields at line 14
Invalid X or Y fields at line 15
Invalid X or Y fields at line 16
Invalid X or Y fields at line 17
Invalid X or Y fields at line 18
Invalid X or Y fields at line 19
Invalid X or Y fields at line 20
Invalid X or Y fields at line 21
Invalid X or Y fields at line 22
Invalid X or Y fields at line 23
Invalid X or Y fields at line 24
Invalid X or Y fields at line 25
Invalid X or Y fields at line 26
Invalid X or Y fields at line 27
Invalid X or Y fields at line 28
Invalid X or Y fields at line 29
Invalid X or Y fields at line 30
Invalid X or Y fields at line 31
Invalid X or Y fields at line 32
Invalid X or Y fields at line 33
Invalid X or Y fields at line 34
Invalid X or Y fields at line 35
Invalid X or Y fields at line 36
Invalid X or Y fields at line 37
Invalid X or Y fields at line 38
Invalid X or Y fields at line 39
Invalid X or Y fields at line 40
Invalid X or Y fields at line 41
Invalid X or Y fields at line 42
Invalid X or Y fields at line 43
Invalid X or Y fields at line 44
Invalid X or Y fields at line 45
Invalid X or Y fields at line 46
Invalid X or Y fields at line 47
Invalid X or Y fields at line 48
Invalid X or Y fields at line 49
Invalid X or Y fields at line 50
Invalid X or Y fields at line 51
Invalid X or Y fields at line 52
There are 134 additional errors in the file

Format of coordinates: N 0 27.888 E 30 18.648

0

1 Answer 1

7

QGIS Add Delimited Text Layer can handle either DD (decimal degrees) or DMS (degrees minutes seconds). But unfortunately your data is formatted in degrees plus decimal minutes (sometimes called DM). Please change the format to decimal degrees and try loading the data again.

If you don't mind using MS-Excel the conversion can be done like below. enter image description here

A2: N 0 27.888
B2: E 30 18.648
C2: =VALUE(MID(B2, FIND(" ", B2)+1, 2))
D2: =VALUE(MID(B2, FIND(".", B2)-2, 6))
E2: =VALUE(MID(A2, FIND(" ", A2)+1, 2))
F2: =VALUE(MID(A2, FIND(".", A2)-2, 6))
G2: =C2+D2/60
H2: =E2+F2/60

EDIT ...... if Southern (S) or Western (W) coordinates are included:

G2: =IF(LEFT(B2,1)="W", -1 * (C2+D2/60), C2+D2/60)
H2: =IF(LEFT(A2,1)="S", -1 * (E2+F2/60), E2+F2/60)

Once calculation is done, save the sheet as csv and load the data to QGIS using X, Y (columns G and H respectively).

2
  • 1
    There might be some tweaking necessary for West and South coordinates. The result must be negative, and the minutes subtracted instead of added to the degrees (even for zero degrees).
    – AndreJ
    May 29, 2017 at 15:04
  • 1
    uh-oh... get to it right away.
    – Kazuhito
    May 29, 2017 at 15:27

Your Answer

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

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