1

This question already has an answer here:

I have a layer with many points on a country, for example, Peru, and I have done a grid grouping all the country. Each hole of the grid has an ID so it's easy to differentiate them. My idea is to set that ID for each point from the other layer that way I can work with all the point on the same hole. In SQL it would be to make a new column called 'ID_Hole' and write the grid ID, but I'm not getting it on QGIS.

Any idea about what should I do?

I attach a more explicative image

The point is obtained from a.csv where I can see the name of the settlement(city) and its located by latitude and longitude on the map.

Example

marked as duplicate by underdark qgis Jan 24 '18 at 18:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    what you need to look for is spatial joint – J.R Jan 24 '18 at 9:44
1

As proposed by @J.R, you can use spatial joint to proceed. Go to Vector menu, then to Data management tools and to Join attributes by location.

As the target vector layer, you can choose the layer containing your points as you want to keep the informations and granularity of this layer. As the join vector layer, you can select your grid.

Keep Take attributes of first located feature checked: your points will only be in one cell of your grid so the first located feature will be the one and only feature located.

Normally, you should obtained a new layer with all your points. Furthermore, in the fields (Right-click, then Properties, then Fields), you shall see that the fields from the grid layer were added to your points layer, including the ID field (you can still delete fields by editing the layer if there are too many fields and you only want the ID).

  • Thank you so much ! I tried with that before, but it didnt work so i gave up. Now, seeing you ensure that it will work i have try again and changing the SRC of one layer (my main error) I have manage the data i wanted. – Victor Jan 24 '18 at 15:04

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