I have been stuck in this problem for a while and hope you can help me solving it.
My aim is to count incidents, which take place inside a 100 km buffer around a mineral mine. Thereby, it is important that only incidents are counted, which are both: inside the buffer and inside the country the mineral mine is in (for these buffers, which crosses country boundaries).
In particular, I have three shapefiles. One with information on the mineral mines (point information), one with information on the incidents (point information) and the third with information on the country borders (polygons).
I start with the shapefile with the mineral mines and use the buffer tool to define a 100 km circular buffer around each mine. The problem is that some buffers stretch over countries’ boundaries. Therefore, I use the clip tool to restrict the buffers to stay within the country boundary. Finally, I join the clipped file with the incidents shapefile and count for each mine the number of incidents in each buffers.
The problem is that not only incidents in the buffer within the country boundaries, but all incidents in a buffer are counted.
I have enclosed a screenshot of such a typical situation. The green diamond is the mine with its buffer, which crosses a country’s boundary (that is the line) and two incidents: one inside the country boundary of the mine and the other outside. Joining now not only counts this one incident, which is inside the country boundary, but counts both incidents.
I have tried around a lot now, but was not able to solve it. I suspect that it has something to do how I clip the file but I do not really know what the problem is. Maybe some of you have ideas and can help me here! It would be a great help and save me some long frustrating nightly overhours…
Thanks a lot, Stefan
thanks for the quick answer. At firt glance your suggestion worked great but then I noticed that I have buffer zones for some mines which overlay each other. Intersect then not only use the overlay between the country border and the buffer but also the other overlaying buffers to cut the area. By this I got in areas with a lot of mines close to each other a lot of strange looking results by using intersect.
I then found out another way which worked for me. I used the tool "spatial join" to connect the mine with the incident points in the buffer. I then exported the data to R and deleted all joins where the countrycode of the mine and the countrycode of the incident point where not the same. By this I got the final dataset including mines with corresponding incident points (inside the country boundary). Maybe it was not the straightest way to do this but it worked out for me.
Thanks again for your help!