I have a shapefile and I need to create an OD cost matrix, but I only need the distances between points which are on the same polyline.
Is there any way to do that?
I am not much familiar with ArcGIS and only know the basics.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You would need to do this in two steps.
Run Spatial Join geoprocessing tool on your points and lines feature classes. This will add a field to the point feature class that will have information about which polyline they intersect.
arcpy or ModelBuilder to iteratively create an OD layer loading all points within every group (that is, those that share the same value for the polyline objectid) as both origins and destination and then solve it. This will give you all-to-all routes.
Look here for the sample on how to do this: Solve (Network Analyst)