Skip to content

Conversation

@kvantricht
Copy link
Collaborator

Fix the special case of multiple features being exactly on a lat or lon line, by adding minimal buffer to the identical lat or lon value right before doing the catalogue query.

Copy link
Collaborator

@HansVRP HansVRP left a comment

Choose a reason for hiding this comment

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

Generally I am confused about the difference in:

if len(shapely_geometries) == 1 and isinstance(shapely_geometries[0], Point):

and the else condition.

The else condition is here constructed to accommodate polygons which are actually points.

Would it not be better then the homogenize this by doing something alike:

 if isinstance(geometry, Point) or (
            isinstance(geometry, (Polygon, MultiPolygon)) and geometry.area == 0
        ):
            geometry = geometry.buffer(0.0001)  # Buffer to create a tiny area

This is some pseudo code, where the point buffer case would be made homogeneous

if bounds[0] == bounds[2]:
bounds = (bounds[0], bounds[1], bounds[2] + 0.0001, bounds[3])
if bounds[1] == bounds[3]:
bounds = (bounds[0], bounds[1], bounds[2], bounds[3] + 0.0001)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can avoid some code duplication here by:

# Ensure min/max are not identical
    min_x, min_y, max_x, max_y = bounds
    if min_x == max_x:
        max_x += 0.0001
    if min_y == max_y:
        max_y += 0.0001

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.

Catalogue requests fail when features are exactly on a latitude or longitude line

2 participants