Jump to content
bonassus

access @ptnum from second wrangle input?

Recommended Posts

How can I access the ptnum of the points coming in though the second input of of a wrangle?

I tried to do it with a point expression but i don't know what to put for the atttibute_name. 

s@name = point(1,"ptnum", @ptnum);

I want to concat the second input's point ptnum with the first input's name attribute after a copy to points sop. 

the copy and transform sop creates a copynum attribute which works to rename copies. but copytopoints doesn't 

How can i do this? 

thanks


 

Share this post


Link to post
Share on other sites

The result of this point call would be an integer. So try...

int local_ptnum = point(1,"ptnum"@ptnum);
s = s@name;
s@name = sprintf("%s_%03d",s,local_ptum);

This will zero pad the point number by 3 digits.

Edited by Atom

Share this post


Link to post
Share on other sites

Hi,

There's a comma missing after the first "ptnum".

Share this post


Link to post
Share on other sites

I'm perhaps misunderstanding the question but if you lookup the point number of a point in another geometry using @ptnum, it's always just going to give you the same value back, no?

You're basically saying 'what is the point number of the point numbered @ptnum'

 

*edit*

Besides, I don't think you can look up point number. You could give the geo in input 1 an id attribute to mirror the point number and look that up, but still if you say 'what's the id of the point with number 3' it's just going to return 3.

Edited by j00ey

Share this post


Link to post
Share on other sites

Thanks for all the responses. Sorry for the confusing question. The answer was obvious after taking a break. 

I only had to:

 @id = @ptnum;

before the second input

and then

s@name = concat(s@name,"_copy_"+itoa(+@id));


after the copytopoints. 

Share this post


Link to post
Share on other sites
On 11/6/2018 at 4:50 PM, Atom said:

int local_ptnum = point(1,"ptnum"@ptnum);
s = s@name;
s@name = sprintf("%s_%03d",s,local_ptum);

This will zero pad the point number by 3 digits.

Atom, thanks for the sprintf tip.

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

×