# How can I do operations with points inside a buffer in GIS

I have a dataset with around 4k schools for with I have their location (longitude and latitude) and enrolment which I have uploaded to a GIS map. I want to do an operation with the competing schools in a 1km radious for each school. The operation is as follows:

I have identified that I need the following steps:

1. Draw a buffer of 1 km around each school
2. Identify all the schools j in that area for school i
3. Calculate the distance between the school i and all the schools j in the area
4. Run the CI formula for school i
5. Add the resulting number to the data table
6. Repeat for all schools

However, I have been unable to go past the second step. How can I do this in a way that covers all the schools?

If you have an advance licence, you can spare some time thanks to the "generate near table tool"

``````GenerateNearTable_analysis (in_features, near_features, out_table, {search_radius}, {location}, {angle}, {closest}, {closest_count}, {method})
``````

Define your search radius as 1km and it will create a table with the x closest point for each point.

You can then use the "field calculator" on this table to compute the E_jd_ij^-2 for each row of your table, but beware of potential division by zero.

Finally, use "summarise table" to sum those values for each unique point value, and divide the result by E_i.

Note 1) that you should project your point into a local XY coordinate system before running your analysis (e.g. UTM), 2) that you could use "spatial join" instead of "generate near table", but then you need to loop on each point and 3) as you already have the coordinate, you don't need a GIS to solve this issue: you can compute the distance between all point using sqrt((x_i-x_j)^2+(y_i-y_j)^2), but I would also project in m before this.

• Thanks for the help @radouxju. I used the "Generate near table tool" and have two issues with the resulting table: 1. The resulting table is not added to the previous data and generates new IDs for the schools, so I cannot identify which school is which. 2. The distance does not seem to make sense. When I multiply the result by 6371 km, the result is over 1 km, which was the search radious (Ex. d = 0.0009984, d * 6371 = 6.36 km) – Alfonso A Jul 17 '18 at 15:51
• For the distance, as I said, I suggest you to project the data in a local coordinate system before you run the calculation, because one degree in latitude is only equal to one degree in longitude if you are at the equator. On the other hand, 6371 km is the (average) radius of the Earth: one degree = 110 km (at the equator, 2*pi*radius/360) – radouxju Jul 18 '18 at 6:55
• for the identifier, it does indeed only provide the FID of the features and it creates a new table. You can "join and relate > join > join attribute from a table" on the FID/OBJECTID field to get the school name – radouxju Jul 18 '18 at 7:03
• to complete the distance information, the size of one degree along a parallel is approximately 110 km * cos(latitude) – radouxju Jul 18 '18 at 7:08
• I'm having an issue when projecting the schools in UTM since the data is as XY Event Source and not as File Geodatabase Feature Class. How could I change that? – Alfonso A Jul 19 '18 at 18:41