Skip to main content

Get One Feature Attribute

Comments

1 comment

  • Victor Catalán

    Hi Michael,

    I do not know about the workflow you mention, so if you are able to share it with us, I would be happy to help.

    In the meantime, some useful information about working with VertiGIS features. As you have normally retrieved these from a VSW operation, you should note the following things:

    Iteration

    The VertiGIS Features can be iterated using JS Array Operations like forEach(), map() or find()

    Example: Find the Feature with OID = 321

    • $runOperation1.result.find(feature => feature.attributes.get('OID') === 321)
    • Result will be the VertiGIS Feature 

    Example: Retrieve a list of all OIDs for all features

    • $runOperation1.result.map(feature => feature.attributes.get('OID'))
    • Result will be a list of OIDs --> [1,2,4,9]

    Get Values

    Once a VertiGIS Feature is retrieved, the values can be accessed using get()

    Example:

    • $runOperation1.result.feature.attributes.get('my-attribute')

    Set Values

    And they can be updated using set()

    Example:

    • $runOperation1.result.feature.attributes.set('my-attribute', 'my new value')
    1

Please sign in to leave a comment.