I have a two polygon shapefiles, one shapefile is a zoning and the second one is a census tract. Now I want to calculate distance from boundary of tract to closest boundary of each zone type (R, C, etc). Because of that I have dissolved all zones according to zone type and now I want to have in each census tract information about nearest distance to the all zone types (distance to C, distance to R, etc...). I am using ArcGIS 10.4 and have trid to use NEAR tool, spatial join but I can't get a distances to all zone types, just to the nearest one.

Also I want to have a zero distance value if each tract contain the zone type or intersect it.

  • You must have an advanced license to use Near so you can generate a near table from census to zoning, join the near table to your zoning then use summary statistics with case field of zone type and summary field of distance, type of minimum, this will give you the min distance from each tract to each unique type of zone type; to use this data you will probably need to split the summary table by zone type before joining to your census tracts by input fid or use a one-to-many relate which isn't as workable.. it just depends on what you want to do with the min distance by zone when it's compiled. – Michael Stimson Oct 31 '18 at 23:41
  • Perhaps you could run the NEAR tool once for each zone type, while the zone layer has a query definition on it for a single zone type. Thereby doing a separate spatial join for each single zone type. – Son of a Beach Nov 1 '18 at 0:18
  • Maybe this is a good solution but I am not sure that works. Also it is very complicated. I already have a complicated solution. If I split my zone shapefile to separate zone shapefile I can run Near tool for each zone and census tract. After calling of every single near tool I can rename distance field to zone name. – user122678 Nov 1 '18 at 0:36
  • You are right, but that is still a very complicated solution. – user122678 Nov 1 '18 at 0:36

Use generate near table with unlimited count of matches, e.g.

arcpy.GenerateNearTable_analysis("CENSUS", "ZONES",closest_count="1000000")

Add census and zone names to NEAR table using IN_FID and NEAR_FID as joning fields.

enter image description here

Bring table into into Excel and use pivot table (minimum) to get what you need:

enter image description here

Input shown below:

enter image description here

  • Interesting solution but I still have a distance just to one zone even I turn on the pivot table. – user122678 Nov 1 '18 at 18:55
  • It means that number of records in near table = number of census blocks. It also means you didn't read first line of my solution. – FelixIP Nov 1 '18 at 19:35
  • You are absolutely right. That works fantastic! – user122678 Nov 1 '18 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.