I have two shapefiles with points distributed over the whole world. I would like to measure the distance (like the crow flies in km) from each point in shapefile 1 to the closest point from shapefile 2, add all the attributes from the closest point of shapefile2 to the point in shapefile1 but at the same time I have to make sure that these distances are only calculated within the same country. The distance measurement should not cross any borders.
I tried to use the Near option and it gives me partly what I want. It adds all the attributes from the closest point in shapefile2 to the closest point in shapefile1 plus it measures the distance. Now the only problem is that it does not take into account if the two closest points are also in the same country. I would need something like an "if" option for the Near tool. Something like "measure distance to the closest point if country in shapefile 1 = country in shapefile 2". Is there something like that??
Any suggestions?