AnsweredAssumed Answered

Calculating geodesic distance to nearest of several points conditional on attribute

Question asked by geonetadmin on Apr 23, 2010
Original User: theisen81

Dear all,

I am having some trouble with generating geodesic distances. I would be extremely thankful if someone could help me with doing this in an automative manner, as I have to do the operation for 46 years (one for each year 1960-2005).

To the problem: I have two layers one point layer (A) with all onshore petroleum resources in the world, and another one (B) which is a fishnet grid converted to a point layer with points representing the center of each original fishnet cell.  I wish to compute the geodesic distance between the closest petroleum resource in layer A for each point in layer B, but there are some qualifications. First of all, points in B in a country without petroleum resources should have a missing value on the distance measure. Secondly for countries with resources the distance to petro-points in A are only relevant for those petro-points in the same country. Thus, onshore gas reserves in North-Eastern USA should not be counted for points in B that are located in South-Eastern Canada. These should have distance to the closest Canadian petro-point.

I suspect that this would involve some python scripting to first generate a POLYLINE file which can be used to calculate geodesic distances (going from the POLYLINE-layer to geodesic distances is not the bottleneck), and I have made some attempts using a python script (I use ArcInfo 9.3.1), but I get a recurring error at the almost the end of the script. I am not aware of any default command or combination thereof in ArcMap that allows me to run this command for all countries at the same time (I could do this for each country for every year 1960-2004, but that would take too much time).

In addition to other variables, both A and B contains x and y coordinates for each point, a numeric code for each country (called gwcode_p).

I have attached the python script, the error message and the A and B in shapefile formats (zipped).

Again, I would be extremely thankful if anyone could help me with this

Best regards,
Ole Magnus

Outcomes