1

I'm trying to append the attributes of the lines (0 or 1) to all the polygons that they intersect (take the mean if multiple lines exist), as shown below. The polygons, lines and the DataFrame are all in the same Geographic coordinate system.

enter image description here

Then I ran a spatial join (see below) with the polygon as target feature, and the line graph as join feature.

enter image description here

The resulting attribute table, however, gives all Null values for all appended attributes ("Test_1" is the field where I put 1 and 0 for the lines).

enter image description here

I saw there's a bug related to the spatial join tool which should be fixed in version 10.5, and the coordinate systems I used for both feature classes are the same.


It worked when I use the "Join and Relate" - "Join" - "Join based on spatial location", however, the spatial join tool in the toolbox still couldn't solve the problem. Would love to know why or the difference between these two tools.

1 Answer 1

1

I recently had this issue when experimenting with a Spatial Join. My solution was to try a "real-world" scenario. I was initially trialing the Spatial Join at a large scale in a random Coordinate System. My results were similar to yours. I tried the join again in my study area with random lines and the join worked.

A potential work around if the Spatial Join still does not work, would be the following:

  1. Perform an intersect between the lines and polygons, ensure the output type is set to Line. enter image description here

  2. The output will be a series of lines which run through / over your polygon. Use the Feature to Point Geoprocessing Tool to create a point at the centre of your line.

  3. Try this new point file in for the Spatial Join
6
  • Hi Keagan, thanks for the reply. The reason I set up this test file is that I failed the spatial join in my real data. Don't know why and don't know how to fix it. So I want to find the solution by using a simple test file as shown above. Will try your solution and let you know if it works tomorrow.
    – Julien
    Nov 27, 2017 at 13:36
  • Is your 'real-world' data points? I'm wondering maybe the spatial join tool only works well with points and polygons, not lines and polygons. Maybe I'm wrong.
    – Julien
    Nov 27, 2017 at 13:40
  • Yes, it was the same setup as yours. I replicated the layout and lines of your example, but in a study area I was working in. Nov 27, 2017 at 18:08
  • What I had in mind is that I would like the attributes of my lines to be added to multiple polygons, so when I transfer my lines to points which lie at the centre of my lines, I couldn't see how it would fit my purpose. However, I did manage to do what I want to do by "join and relates", instead of spatial join tool. Do you know the difference between these tools by any chance? Cheers
    – Julien
    Nov 28, 2017 at 12:13
  • Using the method I described will allow your attributes to be added to all polygons the polylines cross. The output is a series of single part lines (so each line is separate and can be manipulated independently). Nov 28, 2017 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.