[GIS] way to calculate closest distances to a point without using Near Analysis

arcgis-10.0arcgis-desktopdistancepython

I frequently get asked to calculate distances from a specific point (A drilling well in the middle of the sea for example) to a number of Environmental layers (Protected Areas, Pipelines, Other wells etc, so would include points, lines and polygons). I currently do it manually which takes time so I thought there could be a way to automate this using python. It seems the best way to do this is use Near Analysis, which I do not have licence for.

I was just wondering is there anyway to use python to still generate some sort of table that would give me the closest distances from my input feature to my numerous environmental features, the names of said closest features, and the distance (and also direction if possible, but thats not essential).

Any ideas?

Best Answer

Do a spatial join!

First, set up your data frame in a projected coordinate system of your choice (whatever units you want your distances to show up in). So, say you're working in State Plane Feet, make sure all your layers are in State Plane Feet, so if they're not project them into it. From there, Right click on the points layer and click Joins & Relates > Joins.... Make sure to select "Join Layer from another layer based on spatial location." In there, select your layers that you're spatially joining together in the drop down list.

Then, after selected your layer, #2 asks "You are Joining: Points to _" (Points, Lines, Polygons, whatever).

It then gives you two options, the first to give a summary of numeric attributes, and the second option says all the points will be given the attributes of the layer being joined to it, plus it will calculate a distance field. Bingo!

From there, once you run the spatial join your new shapefile will have the distances in the attribute table. Keep in mind if you don't project your shapefiles the distances might show up in decimal degrees though. I hope this helps!

Related Question