Friday, 13 December 2019

ArcGIS 10.3.1: Spatial Join & Count of points on a regular grid


Following the indication given in Counting number of points within a grid I was able to count how many points of a shapefile fall within each cell of a fishnet in my case study.


After loading the shapefile, I have created the fishnet and have used Analysis Tools->Overlay->Spatial Join. The target feature was the fishnet, and the join feature was the point shapefile. I have opted for the Join-One-to-One option, and have added a count field to know how many points are within each cell of the fishnet.


My problem: when I select one cell with multiple points (e.g., the red cell in the image below) I get the correct total number of points (3), but I do not see their IDs.


enter image description here


So I only see the cell ID (117), but not the IDs of the points inside of it. Is there any way I can get these IDs? I need to derive some sort of phonebook where I know that cell i is associated with points p1, p2, ....



Answer



You want to do a spatial join with your points as the Target Layer (so basically think about your analysis in reverse). That will assign the IDs of the fishnet to each point.


The problem is that you have the essential many to one or one to one limitation. Since you only have one record in the fishnet and many in the points, you have to run the analysis in reverse.


The resulting point shapefile will be like your original point file but will include the ID of the fishnet.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...