Here is an illustration of how to distribute field values proportionally to area. I imported a drawing of Mexico states with POP1990. I then created a drawing with a couple of artificial objects overlaying the states, and did Overlay Topology, Identity for that drawing + states. During the overlay, I copied the following fields from the states: MFD_ID for identification and POP1990 because that's what I am interested in. These fields got renamed to O_MFD_ID and O_POP1990 in the resulting drawing. Each object in the resulting drawing thus has some geometry, plus O_MFD_ID and O_POP1990 of the single overlaying state. There are potentially multiple objects with the same O_MFD_ID - a single state is splitting into parts - and they now have the same value of O_POP1990. What we want is to adjust the values of O_POP1990 in these objects to distribute it proportionally to area, giving bigger objects more and smaller objects less, and keeping the sum equal to the original value. To do this, I first computed total area of each O_MFD_ID in the resulting drawing (we could have just taken the area of the original object from states, but I recomputed anyway to allow the transform to alter objects however it wants: throw away their parts, buffer them, etc, altering the area on the way): --SQL9 SELECT o_mfd_id, Sum(GeomArea(geom, 0)) AS area INTO temp FROM [boxes Table Overlay Topology, Identity] WHERE o_mfd_id IS NOT NULL GROUP BY o_mfd_id; Then I took each object in the resulting drawing and changed the value of O_POP1990 to O_POP1990 * area of this object / total area recorded for O_MFD_ID: --SQL9 UPDATE ( SELECT d.mfd_id, d.o_POP1990, d.o_POP1990 * GeomArea(d.geom, 0) / t.area AS POP1990_proportional FROM [boxes Table Overlay Topology, Identity] AS d INNER JOIN temp AS t ON d.o_mfd_id = t.o_mfd_id ) SET o_POP1990 = POP1990_proportional; See the attached MXB. Attachments:
transfer-proportional.mxb
|