Skip to content

Only do geometries.geoms when the attribute is present.#520

Open
EmileSonneveld wants to merge 2 commits into
masterfrom
geoms_attribute
Open

Only do geometries.geoms when the attribute is present.#520
EmileSonneveld wants to merge 2 commits into
masterfrom
geoms_attribute

Conversation

@EmileSonneveld

Copy link
Copy Markdown
Member

#519
@copilot review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Open-EO Open-EO deleted a comment from Copilot AI Jun 25, 2026
@EmileSonneveld EmileSonneveld requested a review from soxofaan June 25, 2026 11:39
def features_ids_from_index(geometries):
return ["feature_%d" % i for i in range(len(geometries.geoms))]
geoms = geometries.geoms if hasattr(geometries, "geoms") else geometries
return ["feature_%d" % i for i in range(len(geoms))]

@soxofaan soxofaan Jun 25, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

features_ids_from_index is already a bit obscure because of lack of type annotations. Adding this if here makes it worse I think

I would fully eliminate features_ids_from_index and just do the list comprehension inline in the if-else below. Something like

        if isinstance(self._regions, GeometryCollection):
            ...
            feature_ids = ["feature_%d" % i for i in range(len(self._regions))]
        elif isinstance(self._regions, DriverVectorCube):
            ...
            feature_ids = (list(feature_ids) if feature_ids is not None
                           else ["feature_%d" % i for i in range(self._regions.geometry_count())])
        else:
            raise ValueError(self._regions)

(Note: GeometryCollection is something we should get rid of, so this would prepare more cleanly for that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants