Correlate (in the form of sub branches) building footprints to their lots

Hi all

I’m struggling to put my mind together on a way to identify and correlate the lots and the buildings on top. The complexity being that some lots have more than 1 buildings within, some buildings spans across multiple lots, and in the example, there is an instance where 2 buildings spans across 4 lots.

I envision the end result to be: While maintaining the first loci (which correlates back to something else in the project), have 1 data stream where the 2nd loci is the individual buildings and the item being the building curves, then a second data stream being the building curve’s corresponding lot/s, meaning there will be duplicates between branches (multiple buildings sharing 1 lot), and sometimes multiple items in the same branch(building spanning across multiple lots).

I tried dividing the building curves into points, then attempted to find relationship using point in curve, and see if a lot has more than a set amount of points, but that didn’t go anywhere.

Quick question is, is it too specific to script? (I’ve only extracted 1/50 of the information)

As a bit of context, the end game is to compile their lot area with the building curves(footprints) as well as FSR to create building massing.

Example.gh (14.6 KB)

Much appreciated.

Quick update: I also tried dispatching the curves according the results of points in curve, and identifying the index of the lot curve it is in, but don’t know where to do from here. The logic is to identify if a building curve has more than 5 points within a lot curve, then it’ll indicate that it belongs to that lot.
Example2.gh (20.4 KB)

For those curious, I’ve come up with a partial solution. It’s not perfect but gets most of the job done.

The idea is to graft the buildings and extract the lots its in. then the reverse to find the lots with multiple buildings.

Those lots with multiple buildings lost their 2nd loci’s tree structure but it maintained the first loci, which is more important to keep for me so that was fine. I also failed to correlate multiple lots to multiple buildings, like the 2 buildings spanning across 4 lots in the example image.

Also there is probably redundancy and over-complication in the script, those with OCD be warned.
Example3.gh (38.5 KB)