Hello everyone,
I have a problem calculating average distances between multiple points to multiple polylines. I have two tables: one is with mapped points, the other is with mapped polylines. The ID number of both tables match. I would like to calculate the average distance of a certain set of points that match to the ID of the certain set of polylines. Example: I would like to calculate the average distance of two homes of one city dweller to three roads in the city he likes most. So, two points (homes) and three polylines (roads) have the same ID since they belong to this unique person. Is there an easy way to calculate the respective distances in ArcGIS? Since I have a set of data with many attributes like this, I cannot calculate it manually by pre-selecting attributes. The near tool does not work.
Could somebody help me to resolve the problem?
Thanks a lot in advance,
Christoph
Solved! Go to Solution.
Hi Christoph.Baumeister , You're welcome. Just wondering, did you try it and if so did it yield the results you are looking for? If that is the case can you mark the answer and the "correct answer". If you haven't tested it yet, you can leave it open. Anyways I will be monitoring the thread for any follow-up. Happy Holidays!
I noticed that you also posted this question in the Web AppBuilder Custom Widgets space (calculate distance multipoints to multiple polylines ). Where do you want to implement this? What should the end result be (a field in one or both of the participating featureclasses). This can be easily implemented with some Python code, but if the idea is to implement this as a Widget then Python is not the way to do this.
Dear Xander,
Thank you very much for your quick response. Sorry for not posting my question correctly–I am new to the community platform. In order to answer your question: a Python code would be perfect for me–I would like to do statistical analysis with the data after calculating distances to see wether I can find correlations. Hence, a table that shows distances between every set of points to the respective polylines would be fine. Would you have some advice on the Python code?
Thank you,
Christoph
Sure, if you can post a sample of you data we can cook some code that you can use. I assume that a field with the mean distance from the points to the lines is what you are looking for? Are the points Point (the ID that should be used to match the lines repeats for multiple records) or MultiPoints (one unique ID for per feature that contains multiple points)?
So Christoph Baumeister , do have some sample data that you can share? I already created some code, but would like to test it with some data.
Dear Xander,
Thank you very much for your help. I ‘ve created two example files. One represents homes (points), the other represents streets (lines). In order to analyze distances, we would like to be sure that each point matches to the respective line–for example person 2304 has 3 homes and marked two streets (ORIG_FID 1098 &1099). We would like to know the distance between home 1 and the mean center of street no 1098 & 1099, the distance from home 2 to the mean center of street no 1098 & 1099, and the distance between home 3 and the mean center of street no 1098 & 1099. Please also note that person 1821 marked 3 homes but no street (which represents quite well the mixed data we have).
Do you have any advice on the code in Python that can cope with this issue?
Thank you very much in advance,
Christoph
...I would love to upload the original excel file–however the available functions only allow me to attach picture-files
To upload the files, you can edit the original post or reply to this one and click on the line "Use advanced editor" in the upper right corner when editing a response:
When you enter the advanced editor there will be an option in the lower right corner of the editor to attach files to the thread.
It would be better to attach the two featureclasses rather than the Excel file(s). That would avoid having to create a geometry from fields. Also you mention the distance to the center of the street, but shouldn't this be the nearest point on the street?
In terms of the nearest point of a street: I think this works as well for our research question. However, we need the mean center of both or more streets since we do not want the number of mapped streets to influence the average distance to points in our analysis. I hope that makes sense...