QGIS Polygon – How to Sort Coordinates According to Polygon Shape

coordinate systemexcelpoint-in-polygonpolygonqgis

I have a list of our sales lead locations in Excel with their coordinates.

What I wish to do is that I need to sort those coordinates as per the condition if they lie within a certain polygon or not. So suppose I have two polygons for two cities then I need to mark the coordinates in the sheet like they’re in polygon 1 or 2 or NIL.

I had been doing this manually in QGIS by selecting the points outside polygons and deleting them and then exporting and then again sorting the sheet but this is now taking a lot of time since the number of entries is increasing.

Could someone suggest a better, simpler and quicker way to do this, irrespective of the method used? I don’t care if, as per your suggestion, it can be done in Excel itself, QGIS, or with the help of some other software. I need to mark in the next column to which polygon the coordinates belong.

input image

output image

Best Answer

I mocked up some input data similar to yours, and loaded it as Lat/Lon using Add Layer -> Add Delimited Text Layer...:

enter image description here

I loaded a layer of Indian states/territories since I don't have your particular polygon data:

enter image description here

I then used the Field Calculator to add a Polygon field of output type = Text using the following expression. overlay_intersects('Indian_States',"Name",limit:=1)[0]

enter image description here

Output seems to be what you are looking for:

enter image description here

Related Question