I have two layers: 1. One with polygons geometry 2. CSV table with more than 600k rows

They have an atribute ID in common, so, I want to distribute randomly each row, inside the polygon as a point. I'm using QGIS 3.4

  • 2
    Your question is slightly confusing. Does layer 1 have just one polygon or many? If it has many, does the common ID link an attribute row to a particular polygon?
    – Stu Smith
    Commented Aug 20, 2019 at 4:44
  • Sorry about that!hehe I was tired...Yes! the layer with geometry has lots of polygons, and both layers have a common ID to link it! Commented Aug 20, 2019 at 22:41

1 Answer 1


QGIS has a tool for creating random points within a polygon. You can use it to populate the number of random points you want. Then join the points layer with the CSV table on the point's id attribute with the table's row index.

Vector > Research Tools > Random Points Inside Polygons https://docs.qgis.org/3.4/en/docs/user_manual/processing_algs/qgis/vectorcreation.html#qgisrandompointsinsidepolygons

If the CSV table doesn't have a field that can be joined, try to calculate the row index. Save the CSV as a GeoPackage to make the attributes editable (reason). Then use the Field Calculator to compute the index with the expression "@row_number".

  • My problem is: the CSV layer has all the information that I need (700k rows), so, I want to join the geometry/polygon reference from the other layer (96 polygons) to that, not the contrary. I don't know if I'm explaining well. When I joined both layers, it compressed my 700k rows to the 96... Commented Aug 20, 2019 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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