1

I am using QGIS. I have three different study sites on an island, and have defined these as three polygons using 'clip'. I want to export the geometry data so I could import it into 'Distance' for study design - however, the polygons have an attribute table that is basically empty. Therefore when I try and export, I get .csv file which only contains the column headings "shapeid" "x" and "y" but no data.

I'm not sure what I have done wrong. The original shapefile that I used as base for clipping has a full attribute table with many points.

  • 1
    Welcome to GIS:SE @Katherine! Did you ensure that the CRS (Coordinate Reference System) for both layers and projection are the same? – Joseph Sep 8 '17 at 10:41
  • Are the datatypes for your new table the exact same as the original? – Konan Pruiksma Sep 8 '17 at 12:28
  • Try using the Intersection tool instead of the Clip tool. – csk Sep 8 '17 at 16:14
  • 1
    It seems to me you're mixing geometry data (the shape of the polygon) and attribute data (the table data) in your title. – gisnside Sep 9 '17 at 7:51
  • I suspect you're right that I am mixing up attribute and geometry data. I guess my underlying problem is that when I try and bring the polygons into Distance, they don't have any geometry data. I found another answer which helped me export as a .csv (MMQGIS plugin) and it was supposed to give me the attribute table and the geometry (I think) as two separate .csv files but the geometry one was empty as described above. – Katherine Sep 10 '17 at 23:09
1

I suggest you restart your work one step at a time :

  • Check the layers CRS . Make sure they are the same (@Joseph's idea in the comments)
  • Check if the layer you are cutting has the attributes you want to keep. If you want to keep the clipper (=the scissors) layer attributes, it's not the right way of doing. f you need to keep every attributes from both layers, you will need to have a look at the Intersect tool for example (@csk idea)
  • Use a tool from the processing panel

Clip tools

  • Open your layer and check
  • Only after can you export the result
  • If it doesn't do what you need, check the options in the CSV export
1

You can print out the polygon coordinates with these PyQGIS code:

path="d:/stackexchange/"
filename = "polygon"
layer = QgsVectorLayer(path + filename + ".shp", filename, "ogr")
iter = layer.getFeatures()
for feature in iter:
    print feature.geometry().asPolygon()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.