topic Calculate the distance from pts to polygon centroids in Geoprocessing Questions
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108724#M3725
<HTML><HEAD></HEAD><BODY><P>I have a census boundary polygon layer and a point layer containing facilities, I would like to calculate the distance from each facility to the centroid of the polygon boundary layer it is contained by. The near function as far as I can tell will only give zeros for pts contained within the polygon so that won't work for me. Also, if I convert the boundary polygons to centroids I don't know how to calculate only the distance to polygon centroids that each facility is contained by.</P><P>Any suggestions?</P><P>I suspect this may be a multipart soloution.</P></BODY></HTML>Wed, 26 Aug 2015 13:18:10 GMTChristinaTardif2015-08-26T13:18:10ZCalculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108724#M3725
<HTML><HEAD></HEAD><BODY><P>I have a census boundary polygon layer and a point layer containing facilities, I would like to calculate the distance from each facility to the centroid of the polygon boundary layer it is contained by. The near function as far as I can tell will only give zeros for pts contained within the polygon so that won't work for me. Also, if I convert the boundary polygons to centroids I don't know how to calculate only the distance to polygon centroids that each facility is contained by.</P><P>Any suggestions?</P><P>I suspect this may be a multipart soloution.</P></BODY></HTML>Wed, 26 Aug 2015 13:18:10 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108724#M3725ChristinaTardif2015-08-26T13:18:10ZRe: Calculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108725#M3726
<HTML><HEAD></HEAD><BODY><P>I think if you use the point facilities layer and the centroids, <STRONG><EM>Near</EM></STRONG> would work.</P><P></P><P><EM>Determines the distance from each feature in the input features to the nearest feature in the near features, within the search radius.</EM></P><P></P><P>Near (Analysis)</P><P><A href="http://help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#/Near/00080000001q000000/" title="http://help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#/Near/00080000001q000000/">ArcGIS Desktop</A> </P><P></P><P></P><P>Chris Donohue, GISP</P></BODY></HTML>Wed, 26 Aug 2015 15:29:07 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108725#M3726ChrisDonohue__GISP2015-08-26T15:29:07ZRe: Calculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108726#M3727
<HTML><HEAD></HEAD><BODY><P>Except I need to calculate the distance from each facility point to only the centroid of the polygon that contains it, not the nearest polygon.</P><P>I'm going to try a spatial join between the facility points and the census boundary polygons to obtain the census polygon ID for each facility point, then in the attribute table I should be able to join using the ID to centroids layer and then calculate the distance between the facility XY to the census boundary centroid XY using field calculator. That's my plan anyway.</P></BODY></HTML>Wed, 26 Aug 2015 19:16:17 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108726#M3727ChristinaTardif2015-08-26T19:16:17ZRe: Calculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108727#M3728
<HTML><HEAD></HEAD><BODY><P>Hi Christina. I looked at this for a while this morning and convinced myself that I could do something very clever with an intersect (facilities and block groups) and a join (facilities to centroids). It didn't work. I suspect that you will need a script which steps through your block groups, selects the facilities within the block group, runs the near tool to the previously created centroid, and then moves on to the next block group record. The Python technology is generically referred to as using cursors to access data.</P><P>Good luck.</P></BODY></HTML>Wed, 26 Aug 2015 19:48:43 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108727#M3728CarlByers2015-08-26T19:48:43ZRe: Calculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108728#M3729
<HTML><HEAD></HEAD><BODY><P>Besides Carls' suggestion of scripting, Modelbuilder could also be a means to accomplish your analysis.</P><P><A href="http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#/What_is_ModelBuilder/002w00000001000000/" title="http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#/What_is_ModelBuilder/002w00000001000000/">ArcGIS Help (10.2, 10.2.1, and 10.2.2)</A></P><P></P><P>It would go something like this:</P><P></P><P>1. Iterate by record for your facility feature class.</P><P>Iteration examples:</P><P><A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000001n000000.htm" title="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000001n000000.htm">ArcGIS Desktop</A></P><P>2. Select by location the Census polygon your facility is in.</P><P>3. Feature to Point of the Census polygon Selection.</P><P>4. Run Near</P><P></P><P>Note - you will probably want to use <EM>In-line Variable Substitution</EM> to name the Near outputs so as to keep them organized. For example, you could have the outputs be named based on the facility ID's.</P><P><A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_inline_model_variable_substitution/002w0000005w000000/" title="http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_inline_model_variable_substitution/002w0000005w000000/">ArcGIS Help (10.2, 10.2.1, and 10.2.2)</A></P><P></P><P></P><P>Chris Donohue, GISP</P></BODY></HTML>Wed, 26 Aug 2015 21:27:06 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108728#M3729ChrisDonohue__GISP2015-08-26T21:27:06ZRe: Calculate the distance from pts to polygon centroids
https://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108729#M3730
<HTML><HEAD></HEAD><BODY><P>So in the end I used the method that seemed the easiest and took the least steps</P><UL><LI> made a spatial join between the facility points and the census boundary polygons to obtain the census polygon ID for each facility point</LI><LI>joined attribute tables using the censusID to centroids layer</LI><LI>calculated the distance between the facility XY to the census boundary centroid XY using field calculator (I actually took the attribute table out and did this calc in Excel as I need to reuse the model for many other census boundaries and faciilty point and I didn't know how to quickly change the Calc to reflect the field names). =SQRT((CensusX-FacX)^2+(CensusY-FacY)^2)</LI></UL></BODY></HTML>Tue, 01 Sep 2015 16:49:39 GMThttps://community.esri.com/t5/geoprocessing-questions/calculate-the-distance-from-pts-to-polygon/m-p/108729#M3730ChristinaTardif2015-09-01T16:49:39Z