Jump to content
Sign in to follow this  
Byter3

Connecting points based on max distance

Recommended Posts

Hi there!

It might be a super easy thing what I'm asking, but I can't find the solution. So a I scattered a lot of points on to a geo, and I want to generate lines between the points, but only if the distance between those n number of points lower than x. I tried write it in wex based on the help, but I couldnt get to work. It might be super easy, just I'm over complicate it. Help would be very much appreciated. Thanks!

Share this post


Link to post
Share on other sites
int nearbyPts[], pt, connectingPrim;
nearbyPts = nearpoints(0, v@P, chf("range"));

foreach(pt; nearbyPts)
{
	if(pt <= @ptnum)
    	continue;
    
    connectingPrim = addprim(0, "polyline");
    addvertex(0, connectingPrim, @ptnum);
    addvertex(0, connectingPrim, pt);
}

Did that from the top of my head, but I think that should work for you.

copy paste it into an attribute wrangle running over points.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you so much for your help!b It does what I really need. I'm going to dig myself into wex. Can't live without knowing wex. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×