Skip to main content
Question

Is possible to access adjacent features (similar to AttributeManager adjacent features) using PythonCaller?

  • August 21, 2017
  • 2 replies
  • 20 views

Forum|alt.badge.img

I was thinking in something similar to feature[+1].

Is this possible?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • August 21, 2017

As far as I am aware the python function does not have this ability, but you can create it using the class.  Note that you'll want to catch the first and last elements of the lists to avoid an index out of range exception (first feature has no previous, last feature has no next)

class FeatureProcessor(object):
    def __init__(self):
        self.featureList=[]
    def input(self,feature):
        self.featureList.append(feature)
    def close(self):
        for i, feat in enumerate(self.featureList):
            previous = self.featureList[i-1]
            next = self.featureList[i+1]

Forum|alt.badge.img
  • Author
  • August 22, 2017

As far as I am aware the python function does not have this ability, but you can create it using the class.  Note that you'll want to catch the first and last elements of the lists to avoid an index out of range exception (first feature has no previous, last feature has no next)

class FeatureProcessor(object):
    def __init__(self):
        self.featureList=[]
    def input(self,feature):
        self.featureList.append(feature)
    def close(self):
        for i, feat in enumerate(self.featureList):
            previous = self.featureList[i-1]
            next = self.featureList[i+1]
Many thanks!