1

I know there may be a really simple solution to this query but I have been looking for one for ages and have not been successful.

I have points that represent mammal sightings on roads, as well as points that represent traffic volume in the UK. I want to join the mammal points to the volume points so I know the traffic volume at each mammal point.

I have tried joining point to point, where the mammal points join to the closest volume point, which worked for some cases, but in most cases the mammal points joined to a volume point that was on a different road. I have also tried converting the volume points to a line but that doesn't seem to have worked either.

Does anyone know a way I can join 1 point to the 5 nearest points, or to join the mammal points to volume points that are on the same road as it?

  • Is there any chance to put a screenshot up? im thinking a spatial join might work. – MacroZED Apr 20 '16 at 14:29
  • I agree with @Zahir_Ibrahim, I think that a Spatial Join with the right combination of "Join Operation" and "Match Option" settings could work for what you're wanting to do. – Nomkins Apr 20 '16 at 14:45
  • A screen shot of the raw data or the points in ArcMap? @Zahir_Ibrahim – Rachel Apr 20 '16 at 14:46
  • @Nomkins, which match option are you thinking would work? I don't see how that would restrict the search to points along the same line. However, this might work: first attribute (most likely via a spatial join) the points with their respective roads; then, perform spatial joins (closest...but definitely set a reasonable search radius as well) on each set of points along the same road. You could accomplish this part with a cursor on geometry or a script that exports each set, performs the join, then applies the attributes to the source dataset. – Tom Apr 20 '16 at 14:56
  • This may not be the most efficient approach but you could try using linear referencing. Assuming you have road data with unique ids, volume points with ids tying them back to roads and sighting points with road id as an attribute, you can locate the sightings and volume points along the roads then do an attribute query/summary to find volume points closest to a particular sighting point along a given road. – Nxaunxau Apr 20 '16 at 15:13
1
  1. Add field type long RoadId to roads and populate it with sequential number, e.g. [FID]
  2. Spatially join mammals to roads (closest), output – shapefile
  3. Spatially join traffic count to roads (closest), output – shapefile. Make it first layer in table of content.
  4. Add field TRAFFIC to both shapefiles, populate it using volume for joined traffic
  5. Run this field calculator expression on field TRAFFIC of joined mammals table:

--------------------------------------------------------------

def FindD ( shp, FID ):
  mxd = arcpy.mapping.MapDocument("CURRENT")
  lr=arcpy.mapping.ListLayers(mxd)[0]
  lMin=1e10
  with arcpy.da.SearchCursor(lr, ('Shape@','Traffic'),r'"RoadID"=%i' %FID) as cursor:
   for p, traffic in cursor:
    lCur=p.distanceTo(shp)
    if lCur>lMin:continue
    lMin=lCur;TRAFFIC=traffic
  try: return TRAFFIC
  except: return -1

----------------------------------------------------------------

FindD ( !Shape!, !RoadID! )

To get this:

enter image description here

Note that green labels are sitting on the top of 'traffic' points

-1

The Spatial Join tool will work for this. Please see the following link for more help: http://help.arcgis.com/EN/ARCGISDESKTOP/10.0/HELP/index.html#//00080000000q000000

The "One-to-many" join operation will allow for multiple Traffic Volume points to be joined to each Mammal Point.

Set the "Match Option" parameter as "closest", and set a search radius of your choosing too. This will search for Traffic Volume points within a set distance and append that to the Mammal Point.

Another tool that can be used is the Near Tool: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001q000000

As described in the help:

NEAR_FID is: The Object ID of the closest near feature. And NEAR_Distance is: The value is in the linear unit of the input features coordinate system, or Meters when the Method parameter is set to GEODESIC and the input is in a geographic coordinate system.

This will only give you the ObjectID of the nearest Traffic points, whereas the Spatial Join will append the Traffic Point attributes to the Mammal Points.

  • 1
    The OP already addressed this, and it didn't work: "I have tried joining point to point, where the mammal points join to the closest volume point, which worked for some cases, but in most cases the mammal points joined to a volume point that was on a different road." Note that the key is that they be on the same road--not that they be the closest points to each other. – Tom Apr 20 '16 at 15:15
  • This solution might work, providing there are one traffic count per road segment. It is going to be after step 3 in my one – FelixIP Apr 21 '16 at 4:06

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.