Find Intersecting Geometry For List of Parcels and Polylines

Can someone explain what I’m doing wrong here? I have a file with parcels and polylines. A polyline crosses each parcel at one point (except for one that is inside a parcel). I’m trying to create a list of XY coordinates for this intersection point. In the image, the top “Geometry” Input node is the list of parcel geometry. The bottom “Other” Input node is the list of polyline geometry. Why am I getting an empty list on my output? Thanks in advance!
Lateral-Crossings.dwg (1.8 MB)
sswr-laterals.dyn (52.9 KB)

Hi @austin_perigee,

Based on the image, it looks like you may have either a lacing issue, a list level issue, or a combination of the two. I would first try and change the lacing in the Geometry.Intersect node from Auto to Longest. Since the list length in the “Geometry” input is different than the list length of the “Other” input, setting the lacing to longest tells the node to check the intersection of the polyline with all the curves that make up the parcel.

I would also check to make sure the number of list inputs are the same at level 2. Potentially setting the list level to L2 in the Geometry.Intersect node may also help produce the desired result.

Hope that helps. It is tough to know without the dynamo script so if you’re still having issues, I would suggest posting to dig a bit deeper.

1 Like

Hello, you have to manage the level of the lists (> click)

here is an example

look at this document very well done


1 Like

It might be simpler to intersect with the parcel geometry as a single polycurve instead of trying to intersect with each parcel segment. So then you might be close to a 1:1 relationship (i.e., one polyline to intersect with one combined parcel curve) and don’t have to think so much about levels and lacing.

1 Like

I’ve tried that, but get the same result. I’ll clean it up in a bit and submit my files which might be easier for people to see where the issue lies. Thanks

I’ve edited the main post to include the .DWG and .DYN files. Thanks for your help!

Thanks for posting the .DWG and .DYN files. Definitely helped clarify why the list was returning empty. I like the suggestion by @mzjensen! I agree, it does help simplify to get close to the 1:1 relationship as you did in the updated .DYN file.

The attached .DYN file is one way to give you the list of points you are looking for. The reason I believe your list was coming up empty previously is that when you gathered all the polylines and all the parcel information into dynamo, dynamo didn’t know the specific polyline that was intersecting the corresponding parcel. The order of the polylines in dynamo didn’t come in the same order of the parcels so it was testing the wrong polyline to the wrong parcel and couldn’t find an intersecting point.

In this case, the lacing of the Geometry.Intersect node needed to be set to cross product so that it could test if every polyline intersected with every parcel. That returns a lot of empty lists but also ensures it gets all the intersection points you want.

sswr-laterals.dyn (75.0 KB)

1 Like

Thank you for sending your solution with the dynamo code so far. I realize now that maybe the Geometry.Intersect node is not the best tool for this task. Each of those polylines represents a sewer lateral servicing each lot. What I actually want to accomplish is to find the length of each line assigned to each lot. Perhaps instead I should have used something like the BoundingBox.Contains node to determine if the polyline start or end points are contained within the Parcel geometry. I need to also make sure that these lengths are reported in the same order that Dynamo lists the Parcels. Would you be able to help me write up something like that? Thanks

I would recommend using the Polygon.ContainmentTest node for this. So get your parcel outlines, get convert them into Dynamo polygons and then run the containment test on the sewer lateral points. The reason is because a Bounding Box is axis-aligned and not element-aligned, meaning that it won’t be truly “shrink-wrapped” to the parcel geometry unless the parcel is perfectly parallel and perpendicular with the world X and Y axes. In other words, the BoundingBox.Contains node might return true even if a point falls outside the parcel boundary. If you want to use Bounding Boxes, you’ll likely have to do some extra gymnastics to get them aligned properly like this example.

A third option, although more computationally heavy, is to patch the parcel polycurves with a surface and then use the Geometry.DoesIntersect node to test if the points intersect with the surface. If they do, then they are within the parcel boundary.


I see. In that case, you were on the right track initially as well using the Geometry.DoesIntersect node as @mzjensen also suggested as his third option. The Geometry.DoesIntersect allows you to determine which polyline crosses the parcels.

The attached script builds upon the previous script using the Geometry.DoesIntersect node. Using the List.AllIndicesOf nodes and the List.GetItemAtIndex allows you to reorder the polylines based on the order of the parcels.

I personally preferred to flatten everything to avoid over complicating the multiple list levels in the reorder of the polyline lengths. If you’d like the same list structure as the parcels in the sites, you can also use the List.Chop node and List.Count nodes to get the list structure of the polyline lengths to the original list structure of the parcels in each site.

Note, the error and the null value is due to the one polyline that does not intersect with the parcel. I think understanding lacing and list levels is the particular challenge in this case. Hope that helps.
sswr-laterals.dyn (77.1 KB)

1 Like

Hi @austin_perigee !

It’s common task.
In real life you’ll face very low speed of that calculations.
Take a look at package called DynamoRtree.
Read this (maybe with google translate): AutoCAD и его объекты. Использование RTree для пространственной индексации данных. | Хроники Георга | Дзен (

And you will need this to get final result:

This approach will speed things up about 10-100 times.
All of that is not hard to understand, fell free to ask any questions!

1 Like

Thank you for these suggestions. I’m attempting the Polygon.ContainmentTest method currently. How do I convert the parcel outlines into Dynamo Polygons? I’m trying to find the right node. If I go straight from Parcel.Geometry to polygon input in Polygon.ContainmentTest, it does not accept this as input.

“Convert” was maybe a bit of a misnomer. Really what you have to do is construct new polygons from the vertices of the parcel using Polygon.ByPoints.

I can put together an example for you a bit later.

Thank You!

Would this work?

This is just getting the intersection points directly, not using the polygon containment approach.

LateralIntersections.dyn (33.6 KB)

Thank You, I found a solution using Polygon.ByPoints and Polygon.ContainmentTest. My total script takes about 3 minutes to run, but it’s worth it for the task at hand.

1 Like