# Assigning point with score to a curve

Hi all,

What I have here is a series of points that are assigned a score. For example, the points are businesses and each business has a unique score. I am trying to assign each point to its nearest curve and then count the scores for each curve. One curve might be assigned 5 businesses with scores of 10,20,50,30,12 and then I want to sum this to get the curve score.

Currently, I am using divide point then the closest point to match a point to a curve. Then I use the ‘series’ as an example for creating the score for each point. However, I struggle to assign the score back to the closest point. But, I have nearly 600,000 points and if anyone had a more optimal way to do this, I would be extremely grateful to save my poor computer from burning.

Best,
T

assign points to curve.gh (33.6 KB)

If I understand you right…

assign points to curve_re.gh (19.7 KB)

Assign point to closest curve (hope i understood this correctly)
Some List managemant to assign the value of each point to the curve
Sum values per curve.

EDIT:
THIS METHOD ONLY WORKS IF THERE IS AT LEAST ONE POINT ASSIGNED TO EACH CURVE. IF THIS IS NOT THE CASE ADJUSTMENTS TO THE DEFINITION NEED TO BE MADE.

assign points to curve_solution02.gh (23.6 KB)

Entire Canvas:

Hi,

This is cool and seems exactly what I was after.

I did find something strange. You can see in the attachment an example. For the green line, it seems there are no lines connecting to it, so I don’t understand why it has a sum of 1003?

for GH.gh (155.8 KB)

Check this as well.

for GH_re.gh (256.1 KB)

2 Likes

Check this for the first file

assign points to curve_2.gh (10.9 KB)

1 Like

Awesome. Thanks - I forgot about pull …

Thanks again!

I actually had more of a conceptual question on this.

I have 50,000 curves in my network, trying to match with 27,000 points. And Grasshopper crashes after about an hour. I was hoping I was just going to leave it for a day or two, and hopefully complete, but no. I have tried turning each component on one-by-one to control it.

I could potentially split it into sections and analyse the street networks separately. but wondered if anyone had had thoughts.

script with points + curves here… forgh2.gh (3.9 MB)

I presume no-one knows a quicker component or method to using the PULL. It crashes after about 1/2 hours of thinking about it…

This is logic , 26987 points projected on 53486 curves , give you 1.5 milliard points !

haha, i enjoy the math regarding how impossible this task is (hence my question).

I wonder if there was a way just to predict 1 point to its nearest curve, instead of projecting them all, which is what im doing now…

I don’t think this is possible, maybe you can create region around group of points and find the nearest curves around them than use pull point

I think pull has an option for only the nearest result. Provided your curves are all in one list at least.

I’ll have to check once I get into the office, but there should either be an input or a menu option for that. Somewhere.

Oh, you’re right. I found it. Thanks, David.

Another less efficient option which worked well for me was just splitting the points into 5/6 groups and computing them groups separately with the whole curve network, then summing the curve totals at the end.