1

I know this could be a duplicate (Merging attributes from point with containing polygon?), but the answer in the link is not clear. I have a very similar task where I want to add district information in a shapefile to a table with attributes of schools in Shanghai area.

This table has information on more than 2000 schools and XY coordinates, but no information on district. I want the polygon information of the district to be added to the school attributes table, so that I can identify the districts each school is located.

As the link directs, I tried spatial join, but the information of the shapefile were not added appropriately to the school attributes table. As in the picture, all shapefile information was added as .

I set the target feature as school attributes table with XY coordinates (sh_np2_Layer) and the join features as the district polygon shapefile (shang_dis_merged), and join operation as join one to many, because I want to join district information to each school point.

I'm bit lost on the parameters part, how should I set it correctly so that I can join the layer and the shapefile correctly? I am especially lost on setting the 'output field' , 'merge source', and 'match option'.

1

You are headed in the right direction, here is some updated resources, Spatial Join, to check out in addition to the post you provided.

Your target is the polygon boundaries and the school locations with the attributes you want to the append are the join features. Use the resources I included to ensure you are inputting your parameters properly as well as selecting the proper merge options and other options.

Joins attributes from one feature to another based on the spatial relationship. The target features and the joined attributes from the join features are written to the output feature class

Usage

  • A spatial join involves matching rows from the Join Features to the Target Features based on their relative spatial locations.

  • By default, all attributes of the join features are appended to attributes of the target features and copied over to the output feature class. You can define which of the attributes will be written to the output by manipulating them in the Field Map of Join Features parameter.

  • Two new fields, Join_Count and TARGET_FID, are always added to the output feature class. Join_Count indicates how many join features match each target feature (TARGET_FID).

  • Another new field, JOIN_FID, is added to the output when Join one to many (JOIN_ONE_TO_MANY in Python) is specified in the Join Operation parameter.

  • When the Join Operation parameter is Join one to many, there can be more than one row in the output feature class for each target feature. The JOIN_FID field makes it easier to determine which feature is joined to which target feature (TARGET_FID). A value of -1 for JOIN_FID field means no feature meets the specified spatial relationship with the target feature.

  • All input target features are written to the output feature class only if:

  • The Join Operation is set to Join one to one, and Keep All Target Features is checked (join_type = "KEEP_ALL" in Python). Merge rules specified in the Field Map of Join Features parameter only apply to attributes from the join features and when more than one feature is matched to a target feature (when Join_Count > 1). For example, if three features with DEPTH attribute values of 15.5, 2.5, and 3.3 are joined, and a merge rule of Mean is applied, the output field will have a value of 6.1. Null values in join fields are ignored for statistic calculation. For example, 15.5, , and 2.5 will result in 9.0 for Mean and 2 for Count.

    *When the Match Option is set to Closest or Closest geodesic, it is possible that two or more join features are at the same distance from the target feature. When this situation occurs, one of the join features is randomly selected as the matching feature (the join feature's FID does not influence this random selection). If you want to find the 2nd, 3rd, or Nth closest feature, use the Generate Near Table tool.

Also, Spatial joins by feature type

Will help you decide on the merge choice

A spatial join involves matching rows from the join layer to the target layer based on a spatial relationship and writing to an output feature class. When a match is found during processing, a row is added to the output feature class containing the shape and attributes from the target layer, and the matching attributes from the join layer. The spatial relationship is determined by the geometry types of the input layers as well as the chosen match option. The table below describes the spatial relationships.

Per your comments question on merge rule - Merge rules

The merge rule property of an output field allows you to specify how values from two or more input fields are merged into a single output value. Null values will be excluded from all merge calculations. There are several merge rules that you can use:

  • I think one problem is that there is no 'feature' that arcgis can recognize, the shapefile and the school attributes table do not share a variable, as in when conducting a 'join' data type of geoprocessing. – song0089 Oct 10 '17 at 14:40
  • Then what should I specify at the 'source' tab? And the 'merge rule'? – song0089 Oct 10 '17 at 14:48
  • I followed through, but still get columns full of null (district attributes) – song0089 Oct 10 '17 at 15:33
  • Can you post your attribute tables for post files with screen shots and update you post? – whyzar Oct 10 '17 at 15:35
  • I added the screen shots. – song0089 Oct 10 '17 at 15:52
0

I found that the problem was caused by not saving the XY event layer (the school layer) as a shapefile. I exported the event layer and created a new shapefile, and then used the shapefile to conduct spatial join with the district shapefile. This worked!

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.