Jump to content

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!

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...