Is it possible to export geometry data from a shapefile to CSV from QGIS?
Asked Answered
M

3

6

I'm trying to get geometry data from a large quantity of shapefiles into a database (Google Datastore). The thing is, I don't need to work with maps, I just need the coordinates, so I would like just the numerical coordinates. Ideally I'd like to use CSV, but any plain text would be workable. I have a Mac and have been able to get QGIS installed (I also tried udig but the interface was baffling). While it is easy to load a shp file into QGIS as a vector layer, I'm lost as to how to export the geometry, or even if it is possible.

Does anyone know how to extract plain text geometry from a shp file? Ideally with QGIS, but any method would be appreciated.

Musaceous answered 30/10, 2015 at 11:46 Comment(0)
M
-2

Update:

See here for a solution: https://gis.stackexchange.com/a/8846

Outdated Response:

It is possible, in a sort of roundabout way...

  1. Open the attribute table for the layer you want to save.
  2. Select all rows.
  3. Copy the rows
  4. Paste into a spreadsheet
  5. Save the spreadsheet as a csv.

Unfortunately there is no way to do this directly in QGIS.

See here for more details: https://gis.stackexchange.com/questions/8844/get-list-of-coordinates-for-points-in-a-layer/8911#8911

Maximilianus answered 18/11, 2015 at 0:46 Comment(1)
There might be some difference with versions, but this is easily done directly in QGIS. The accepted answer on the link you posted also shows this.Nonet
N
12

The "You can simply right-click the layer entry in QGIS and select "Save as"" approach was right

enter image description here

But the "GEOMETRY=AS_WKT" in the OGR layer option was missing.

I may also be a good idea to convert the coordinate system to WGS 84, as CSV are usually expected not to be projected (and shapefile sometimes are)

enter image description here

Nonintervention answered 5/11, 2019 at 16:6 Comment(0)
N
5

You can simply right-click the layer entry in QGIS and select "Save as".

"Save As" option on the Layers Panel in QGIS

In the dialog, there's an option to save as "CSV".

enter image description here

There are plenty of options to refine the format of the generated CSV file, as well as there are many other file formats to choose from.

Nonet answered 19/12, 2018 at 13:12 Comment(3)
Well @JacquesMALAPRADE that is very broad statement. What didn't work? Was the option not there? did the file have any format issue? If you were more specific maybe that could be more helpful for other users.Nonet
Well @LucasFranceschi it created a csv file with no data only headers. BTW tried the above parameters and various others.Allahabad
How to achieve this format that includes brackets? i.imgur.com/OXOjUiy.pngKillick
M
-2

Update:

See here for a solution: https://gis.stackexchange.com/a/8846

Outdated Response:

It is possible, in a sort of roundabout way...

  1. Open the attribute table for the layer you want to save.
  2. Select all rows.
  3. Copy the rows
  4. Paste into a spreadsheet
  5. Save the spreadsheet as a csv.

Unfortunately there is no way to do this directly in QGIS.

See here for more details: https://gis.stackexchange.com/questions/8844/get-list-of-coordinates-for-points-in-a-layer/8911#8911

Maximilianus answered 18/11, 2015 at 0:46 Comment(1)
There might be some difference with versions, but this is easily done directly in QGIS. The accepted answer on the link you posted also shows this.Nonet

© 2022 - 2024 — McMap. All rights reserved.