Reputation: 7039
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.
Upvotes: 6
Views: 32761
Reputation: 4040
Update:
See here for a solution: https://gis.stackexchange.com/a/8846
Outdated Response:
It is possible, in a sort of roundabout way...
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
Upvotes: -2
Reputation: 193
The "You can simply right-click the layer entry in QGIS and select "Save as"" approach was right
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)
Upvotes: 12
Reputation: 428
You can simply right-click the layer entry in QGIS and select "Save as".
In the dialog, there's an option to save as "CSV".
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.
Upvotes: 5