카테고리 없음 2023. 3. 3. 03:18

Tip #1. Exporting (X,Y) coordinates from a shape file (source: https://sites.google.com/a/wisc.edu/wiscsims-micro-qgis/learn-to-use-qgis/exporting-data/exporting-x-y-coordinates-from-a-shapefile)

Exporting (X,Y) Coordinates From a Shapefile

 
Perhaps you have multiple datasets, with different machine coordinates, that you have unified into a single map. Or perhaps you want to process shapefiles in a dedicated coding language, such as Matlab or R. For both of these cases, it is useful to be able to export shapefile coordinates out of your QGIS map.

Exporting (x,y) coordinates from a .shp file

The x,y coordinates that define any vector(s) within a layer, along with their attached attributes, can be quickly exported as a .csv via the following steps. These coordinates are pulled directly from the vector file and so are spatially accurate, even if you've moved vectors away from the original x and y positions you used to load the vector file.

First, you’ll need to extract the nodes that define the line(s) or polygon(s) in your layer. If you are only trying to export a set of points, then skip straight to step 2. If you have lines or polygons, continue on to step 1.

(1) On the menu bar, select Vector -> Geometry Tools -> Extract Vertices. A popup box will ask which layer you wish to extract nodes from, and how you want to save the new layer. Click OK, and a new points-only layer should appear.

(2) In the layer window, right-click the layer with the points you wish to export, and select Export-->Save Features As...

(3) Under Format, select Comma Separated Value (CSV).

(4)Under Save as, give the new file a save location and name.

(5) Under Layer Options, make sure Geometry has AS_XY selected.

That should do it. Click OK.

Open the file where you saved it. You'll notice that there are now new X and Y columns that contain the correct spatial coordinates in QGIS.
posted by kimsooil
: