Saving as a CSV

Let’s say I have a collection of points and I’d like to convert them to a CSV. It’s simple to do in QGIS!

Step One: Open Your Layer

First, open up your layer to import it into QGIS. When I double-click it opens for me, but you might need to do Layer > Add Vector Layer. It will appear on the list of layers on the left-hand side.

Add Vector Layer

Step Two: Check the attributes

When you save as a CSV, it only saves the per-point attributes, not the geographic data. Let’s take a look a the attribute table to see what’s included - right-click, then “Open Attribute Table”.

If we scroll back and forth between the columns, we see there’s no X and Y or lat and lon columns. Let’s make some!

Step Three: Adding lat/lon columns

From the top menu, select Vector > Geometry Tools > Export/Add Geometry Columns

For my CRS, I picked Project: the file itself is in the New York State Plane CRS, but I’ve set the Project to be EPSG:4326/WGS 84. By using WGS 84 for the geometry fields, I’ll get latitude and longitude as my result. If those words don’t make sense to you, read this and this or just try and risk it - you’ll know if it went wrong in the next step.

After it’s updated the layer, click Close. If you get a warning about “simultaneous access” you can just ignore it.

Step Four: Checking Your Work

Open up your attribute table again…

And scroll all the way to your left. New columns, at your service: XCOORD and YCOORD!

If your numbers don’t look like latitude and longitude (e.g. they’re well over 100), you probably have a CRS issue. Go read What is a CRS? and Changing CRS with QGIS and you’ll be good to go.

Step Five: Actually saving it as a CSV

Now that the latitude and longitude are in the attribute table, you can actually save the file as a CSV.

Right-click your layer, select Save As...

As long as the Format is CSV, the other options really don’t matter. CRS isn’t important since it’s only saving the attribute table, not any of the inherent geographic data.

Now you’re all set - open it in Excel if you’d like to triple-check!

Want to hear when I release new things?
My infrequent and sporadic newsletter can help with that.