Jump to content

How to enumerate primitive attributes ?


Recommended Posts

I have imported city data from OpenStreetMaps with Labs OSM import.

There are hundreds of primitive attributes in the resulting geometry.

How do I get an idea of where the useful data are ? 

Like removing the attributes that are empty or mostly empty, and generate a list of the values that are actually used for the attributes that look promising.

So far, I'm using :  uniquevals(0,"prim", known_attribute)

attribute promote, array of all / min / max

But I'm looking for a way to generate this summary programmatically, regardless of the input. So I'm looking for a VEX function that enumerate primitive attributes as a string array. That would be a good starting point.

Link to comment
Share on other sites

5 hours ago, AntoineSfx said:

I have imported city data from OpenStreetMaps with Labs OSM import.

There are hundreds of primitive attributes in the resulting geometry.

How do I get an idea of where the useful data are ? 

Like removing the attributes that are empty or mostly empty, and generate a list of the values that are actually used for the attributes that look promising.

So far, I'm using :  uniquevals(0,"prim", known_attribute)

attribute promote, array of all / min / max

But I'm looking for a way to generate this summary programmatically, regardless of the input. So I'm looking for a VEX function that enumerate primitive attributes as a string array. That would be a good starting point.

Found it .

Thanks to a post on sidefx.com 

https://www.sidefx.com/forum/topic/31699/

 

I'm reposting it here for SEO sake because for some reason I could not find it easily

The problem was to enumerate primitive attributes.

###########

Linked Question: list of attributes

I have an attribute wrangle node that is making new geometry and none of those points inherit the attributes from the point that is being processed when that geometry is being created.

I'd like to loop over the attributes on the source geometry and copy them to the new points, but I can't find a vex function to provides a list of attributes or a way to get attributes by something other than its name. I was thinking I could do an import attribute by index (if such a thing existed) until it started failing. But I don't see how to do that either.

 

The answer is:

s[]@pointattribs = detailintrinsic(0,"pointattributes");
s[]@primattribs = detailintrinsic(0,"primitiveattributes");
s[]@vertexattribs = detailintrinsic(0,"vertexattributes");
s[]@detailattribs = detailintrinsic(0,"detailattributes");

###########

 

It's not clear how we are supposed to find the strings that are used as the second argument of detailintrisic. The string "primitiveattributes" doesn't exist on sidefx.com, and it's not like there is a BNF to generate those.

Anyway.
Starting from that list, it is now trivial to implement what I asked initially.

spreadsheet.png

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...