This might be stupid but I am trying to put points collected on the field to match the location from where they were originally collected. AS the X and Y coordinate of the point might not match the location of the polygon. Let me explain:-

Look at the ID

For example If I have a point with the Same ID (imported from a CSV) I want it to show up on top of this polygon. This point will have some additional information relevant to this polygon and is updated every month. I know I can use the X & Y coordinates of the point but the issue is that the X & Y coordinates of point are not reliable as they change every time the point is collected.

I am using QGIS.

  • Can you explain further (edit) the relationship of the point and the polygon. I get that you are collecting point data over a period of time and the X/Y moves with time for each point with a unique id. but how does that match with the polygon? are you saying you have multiple unique points in a polygon?
    – nmtoken
    Commented Apr 5, 2018 at 10:02
  • So its like this when we collect a point form a particular polygon, we write the source of the Point corresponding to the ID number of the polygon. We collect the point every month, each time the source will be the same, but the point will have a unique ID. Commented Apr 6, 2018 at 10:28

2 Answers 2


I might be mistaken, but it sounds like the actual location of the sampling point is not important, just the fact that the sample related to a particular polygon.

If this is the case, then I would suggest you do a table join between the Polygon and the Sampling Points using the Polygon ID as the link.

Using this link: https://www.qgistutorials.com/en/docs/performing_table_joins.html

It would be possible to trial it on your datasets. I am not familiar with the process in QGIS, but using this link you would:

  • Right click the polygon layer in the Table of Contents
  • Select properties
  • In the properties, select joins
  • Then select the green plus button in the bottom left of this window

Use the point samples as the input and the IDs of the polygon and point as the joining fields.

I am not sure if the joins are permanent, you may need to export the joined polygon layer out to make it a permanent join.


Start with the Polygon and calculate the coordinate of the centroid of the Polygon. Export the Polygon ID and the coordinates to a CSV File. Open this CSV in Microsoft Excel. Format the Excel Document so that Column A is the PolygonID, B is X and C is Y.

Take your Point File and either export the Attribute Table to CSV or open the DBF. Save this table as an XLS file. Copy the Polygon ID CSV from the step above and save it in Sheet2 of this spreadsheet.

Add two new columns to the sample point file called X and Y. Create a VLOOKUP using the Sample ID as the Lookup field, adding the X and Y values into the associated fields in your Point Table.

So summarising. Your Excel Document will have 2 Sheets. Sheet 1 containing the Point Sample data, with the Sample ID the same as the Polygon ID. Sheet 2 will contain the Polygon ID and coordinates of the centroid coordinates.

In Sheet 1 insert two fields called X and Y into Column B and C. In Cell B2 of the Sheet 1 use this formula:


In C2 put this formula.


This will give you the X and Y Coordinates of the polygon centroid for that particular sample. Drag the formula down and then save the Excel Doc.

In QGIS create a point file using the Sheet1 coordinates you just calculated above. There should be two points at locations where two samples were taken in the same block.

  • This is great. Is there any way to automate this process, otherwise I would have to do this every time there is an update to the point data. I know this is like a beggar choosing but any help would be grateful. I would try this technique now and report back. Commented Apr 6, 2018 at 10:34
  • The problem I am facing is some polygons have multiple points which causes problem as they overlap. Commented Apr 6, 2018 at 11:34
  • Yes ok that might cause issues...I do not know of a way to automate it in QGIS - I am primarily an ESRI user Commented Apr 6, 2018 at 12:40
  • @user3659729 I added an additional method to assist...it uses Excel Commented Apr 6, 2018 at 13:08

Step 1: Add X and Y coordinate fields to the polygon layer.

Assuming you want the points located at the centroid of each polygon, use the field calculator to add fields with these formulas:

  • Field name: "X_coord" ... Formula: x( centroid( $geometry))
  • Field name: "Y_coord" ... Formula: y( centroid( $geometry))

Step 2: Import the point csv file as an attribute only table

Step 3: Join the csv table with the polygon layer.

Open layer properties for the csv table > Joins > add new join

  • Join layer: your polygon layer
  • Join field: "id"
  • Target field: "id"
  • Choose which fields are joined > select "X_coord" and "Y_coord"

Step 4: Export the joined table as a csv file

Step 5: Import the joined table.

Use "X_coord" and "Y_coord" as the X and Y fields, respectively.

  • This is wonderful and solves my problem of multi points in a single polygon problem. Anyway to automate this process? Commented Apr 6, 2018 at 12:03

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.