Skip to content

Issues with gridintersect for structured grid #995

@tomvansteijn

Description

@tomvansteijn

I ran into some issues using gridintersect for a structured grid and a large polyline dataset.

  • the transform function is seemingly called on X,Y of the first and second point of each vertex instead of two arrays of X and Y coordinates. This seems incorrect. see:
    rx, ry = transform(
    [pt[0]],
    [pt[1]],
    self.mfgrid.xoffset,
    self.mfgrid.yoffset,
    self.mfgrid.angrot_radians,
    inverse=False,
    )
  • when processing multilinestring, the rotate function is called on a list of geometries instead of a geometry. This seems to fail. The function should iterate over each geometry in the list and perform rotation and translation. See:
    ix_realworld = rotate(
    ix, self.mfgrid.angrot, origin=(0.0, 0.0)
    )
  • the _check_adjacent_cells_intersecting_line method fails when intersection produces a GeometryCollection instead of a MultiLineString. GeometryCollection is a composite geometry with the geoms attribute, and should be processed similar to a MultiLineString. More generally this function should check for the presence of the geoms attribute.
    if intersect.geom_type == "MultiLineString":
    x, y = [], []
    for igeom in intersect.geoms:
    x.append(igeom.xy[0])
    y.append(igeom.xy[1])
    x = np.concatenate(x)
    y = np.concatenate(y)

Can do a PR with quick fixes if desirable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions