Map a many to many relationship

1922
6
02-11-2013 01:37 PM
JorgeBraque
New Contributor
Hello friends,
I used the tool "ArcToolbox>Data Management Tools>Relationship Classes>Table to Relationship Class" to establish a relation (many to many) between land parcels and owners. I already had the intermediate table. The question is how can i make a thematic map that shows the number of owners a parcel has?
For example:
light blue color=1 owner
darker blue=2 owners
dark blue=3+ owners

Thank you
Tags (2)
0 Kudos
6 Replies
RichardFairhurst
MVP Honored Contributor
Hello friends, 
I used the tool "ArcToolbox>Data Management Tools>Relationship Classes>Table to Relationship Class" to establish a relation (many to many) between   land parcels and   owners. I already had the intermediate table. The question is how can i make a thematic map that shows the number of owners a parcel has? 
For example: 
light blue color=1 owner 
darker blue=2 owners 
dark blue=3+ owners 

Thank you


You cannot do that directly from a many-to-many (Parcel to Owner and vice versa) or one-to-many (Parcel to Intermediate table or Owner to Intermediate table) relationship. You must generate a Summary Statistics table from the Intermediate table and use the Parcel values as the unique Summary case field. The summary will automatically generate a Count field. That count should represent the number of owners connected to the parcel (assuming uniqueness of each many to many relationship was maintained). Because the Summary table will be a one-to-one relationship to your Parcels, you can join the Parcel features to this summary table. That join will allow you to create the map you want to make. Optionally you can calculate the count values into the Parcel feature class.

There is no way to have the map respond to live edits. You must regenerate the Summary table to reflect edits to the many-to-many relationship. A model should be part of your workflow to make tha easy and fast to do at the end of your edits or during the edit process for validation.
0 Kudos
JorgeBraque
New Contributor
Thank you very much. I will give a try.
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thank you very much. I will give a try.


Because the Intermediate table is somewhat protected by ArcMap and I have not really attempted this before, I looked at the help on these kind of relationships to verify the table can be exposed.  See http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//004t00000004000000.htm
It appears you must add the relationship class to the map to make the tableview for the Intermediate table visible.  As a table it should have the Summarize option when you right click a field.  For starters verify you can do that.  It is possible that a copy of the Intermediate table would have to be created before ModelBuilder would use it in a Summary Statistics operation.  Take it one step at a time to get a better understanding of what you can do with the relationship class.
0 Kudos
JorgeBraque
New Contributor
Well i spent almost a day but finally i solved the problem with a python script.
0 Kudos
RichardFairhurst
MVP Honored Contributor
Well i spent almost a day but finally i solved the problem with a python script.


Share the script please.  This post is not much use to anyone (other than you) without it.
0 Kudos
JorgeBraque
New Contributor
import arcpy
from arcpy import env
def sumOwners():
    mxd=arcpy.mapping.MapDocument("CURRENT")
    wrkPath=mxd.filePath[0: mxd.filePath.rfind('\\')]
    env.workspace=wrkPath+"\\data.mdb"

    Pclass=wrkPath+"\\data.mdb\\contamination\\parcel"
    Rtable=wrkPath+"\\data.mdb\\owners2"

    Prows=arcpy.UpdateCursor(Pclass)
    Rrows=arcpy.SearchCursor(Rtable)

    nameLst=[]
    for i in Rrows:
        nameLst.append([i.getValue("P_No"),i.getValue("Owner_Name")])

    lst=[]
    s=""
    for i in Prows:
        code=i.getValue("Code")
        for j in nameLst:
            if code==j[0]:
                s+=j[1]+"\r"
        s=s[:-1]
        i.setValue("Owners", s)
        Prows.updateRow(i)
        s=""

Does anyone know how can i debug python scripts. The documentation of arcpy is so poor...
0 Kudos