5

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.

Katharine Osborne
  • 6,571
  • 6
  • 32
  • 61

3 Answers3

11

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

Pablo
  • 183
  • 2
  • 8
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.

Lucas Franceschi
  • 398
  • 6
  • 12
  • 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. – Lucas Franceschi Sep 26 '19 at 11:45
  • Well @LucasFranceschi it created a csv file with no data only headers. BTW tried the above parameters and various others. – Jacques MALAPRADE Sep 26 '19 at 13:39
  • How to achieve this format that includes brackets? https://i.imgur.com/OXOjUiy.png – user4015 Jan 22 '20 at 02:11
-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

mkirk
  • 3,965
  • 1
  • 26
  • 37
  • 2
    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. – Lucas Franceschi Dec 19 '18 at 13:16