1

I've been using positionAlongLine to create points that are supposed to line up with the lines from which they are derived.

When I tried to use SpatialJoin_analysis with the match_argument set to "INTERSECT" , I'm not getting all of my points represented in the output point set. After zooming in ridiculously far on an example of one of my errant positionAlongLine-generated points and the original linework, I can see that the point is 0.000025 meters away from the line that it is based on.

I really just want my SpatialJoin_analysis to work with "INTERSECT". I've tried specifying a search_radius of 1 with no improvement in results. Short of continuing to use "CLOSEST" as a workaround, which is a bit cheesy, I'm wondering if there is a way to improve the precision of the coordinates I get with positionAlongLine or the NumPyArrayToFeatureClass I use to bring the coords back into ArcGIS to create the points featureclass. I'm also happy to do something to make the SpatialJoin_analysis handle the gap, too.

---Update 1---

Tried @radouxju's suggestion. Can't seem to get NumpyArrayToFeatureClass to create anything w/in a FD. Results just appear at top of fgdb (w/no warnings, which seems odd). Copying the source FC to the top of the fgdb and then doing the analysis doesn't remove the shift.

Going to isolate the point geometry in my numpy array to see if that's the source of the error.

Guessing the solution will not be to fix this, but to improve the SpatialJoin....

---Update 2---

Checked the coordinates in my numpy array and they do fall on top of the line (at least as close as I can visually verify), but NumpyArrayToFeatureClass is not honoring the full precision (dropping decimal places) in the points of the featureclass it creates.

enter image description here

Roland
  • 1,290
  • 9
  • 21

2 Answers2

1

I had the same problem once: it was due to the different storage of coordinates values between my two datasets. The best way to avoid this is to have both your lines and your points in the same feature dataset in a geodatabase. At least it solved the problem in my case.

radouxju
  • 49,636
  • 2
  • 71
  • 144
  • Interesting. My lines are coming out of a class held in a feature dataset, but NumPyArrayToFeatureClass seemed to require that the array be loaded back into the top level of the fgdb--was thinking because the function uses a spatialReference as an arg. Still a little odd. Didn't seem to make a difference that the SR of the FD and the array matched. I'll fool around with that a bit and report back. – Roland Jan 31 '14 at 22:17
1

I think I got it. By explicitly specifying a arcpy.env.XYTolerance value larger than my gaps prior to invoking the SpatialJoin, all the intersections were found.

I also tried something that did not work, but seems like it should. When using NumpyArrayToFeatureClass, one passes in a SpatialReference object. I was hoping by setting both SpatialReference.XYTolerance and, perhaps more importantly for the ingestion process, SpatialReference.XYResolution, the output point feature class would not lose the positional detail that was in the numpy array and then SpatialJoin would work. No such luck. Thinking that NumpyArrayToFeatureClass is still maturing (although already a huge help to me).

The whole positionAlongLine thing is interesting. I think arcpy interpolates the position. Using the results for overlay analysis with infinitely thin line features can be a tricky thing!

Roland
  • 1,290
  • 9
  • 21