3

I'm trying to import a CSV file with geolocated attributes, but the format is not recognized:

Exemple

Is there a way to automatically recognized it?

EDIT: I think what I need is a batch converter to replace (for example) 9.8N /42.8W by 9.8 / -42.8. I'm looking for that tool.

IDT 2: here is the csv sample https://gofile.io/d/8QsYwb

2 Answers 2

7

Try the same approach with "Geometry by expression" described in @Luis Perez's answer. However, deploy a bit different expression

make_point(
    if(regexp_match("Longitude (deg.)", 'W'),
    -regexp_substr("Longitude (deg.)" ,'[^A-Z]+'),
    regexp_substr("Longitude (deg.)" ,'[^A-Z]+')
    ),
    if(regexp_match("Latitude (deg.)",'S'),
    -regexp_substr("Latitude (deg.)" ,'[^A-Z]+'),
    regexp_substr("Latitude (deg.)" ,'[^A-Z]+')
    )
)

geometry_by_expression

And get the output

result

Using transform() is allowable.


References:

5
  • I get the idea, but your expression doesn't work :/
    – Foaly
    Commented Oct 31, 2020 at 14:35
  • No error, but the attributes still cannot be geolocalized (the coordinates format still unchanged)
    – Foaly
    Commented Oct 31, 2020 at 14:47
  • 1
    Done in my 1st post ;)
    – Foaly
    Commented Oct 31, 2020 at 14:57
  • Can you please give a hint what do your points represent?
    – Taras
    Commented Oct 31, 2020 at 15:20
  • These are the fireballs reported by US government sensors for the last 30 years :) Thank you for you assistance, your trick will be useful for me for future work !
    – Foaly
    Commented Oct 31, 2020 at 15:36
0

In the past, I've fixed such problems in Excel. Add a column, filter for anything tagged S or W and calculate -1 in that column, and fill the rest with 1's. Find replace to get ride of all the NSEW characters. Then multiply column values by either 1 or -1.

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.