2

I am looping through Municipalities and clipping a layer called AllZones containing Multiple Facility (FACID) with multiple chemicals per Facility (CID). 1 to many relationship

           FacilityID,        CID,  other rows......
ex rows:        001              2           
                001              2           
                001              2          
                001              5           
                001              5          
                001              7         
                001              7           
                002              11         
                002              12          
                002              14    

that result layer I then dissolve it down just by the FACID (call it labeldissolve) so I can generate 1 label for each facility on the map based on the new objected id.

   OBJECTID,  FacilityID
       1          001
       2          002

My next step is to create a report of the AllZones layer info for that given municipality. I want those created OBJECTID labels in the labeldissolve layer to correspond to the report. I tried joining the two tables in ArcMap based on the FACID and it works fine.

enter image description here

When I tried it in arcpy I did not have the option to choose keep only matching records

here is my code

arcpy.JoinField_management("AllZones", "FACID", "LabelDissolve", "FACID","")

should I be using a spatial join?

3

Not spatial join, it's still an attribute join. I have not used either of these arcpy functions myself, but it looks like AddJoin_management() has some options to specify the join type KEEP_COMMON:

Add Join - ArcGIS Desktop Help

  • perfect-very surprised the regular arcpy.JoinField_management tool does not have the KEEP_COMMON join type option – ziggy Jun 7 '16 at 17:03
  • 3
    @ziggy Join Field adds the join table data to your input table (it modifies the table). It won't remove any data from your input table, which is why KEEP_COMMON isn't an option. – Midavalo Jun 7 '16 at 18:37

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.