PreparedGeometry: add Crosses method

Open
#700 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go
Domain
backend, databases

Research direction

Start by reading the PreparedGeometry implementation added in #699 and trace its Crosses path through RelateMatrix and RelateNG. Compare the two possible approaches in the issue, including the existing xmltest failure for EqualsTopo on degenerate geometries. Done means prepared Crosses handles geometry collections without changing the established EqualsTopo behavior.

Written by the indexing model from the issue text.

Description

jtsport

Summary

PreparedGeometry is missing the Crosses predicate. All other spatial predicates are supported (Intersects, Contains, ContainsProperly, CoveredBy, Covers, Disjoint, Overlaps, Touches, Within).

PreparedGeometry was added in #699.

Background

The underlying JTS prepared geometry implementation delegates Crosses to baseGeom.Crosses(), which calls RelateMatrix() → geom_GeometryRelate_Relate(). When the global isRelateNG flag is false (the default), this code path calls CheckNotGeometryCollection and panics for geometry collection inputs.

The non-prepared geom.Crosses works fine because it goes through Relate() → jtsRelateNG(), which always uses RelateNG and handles geometry collections.

Switching the global isRelateNG flag to true fixes Crosses but introduces a behavioral difference in EqualsTopo for degenerate geometries (e.g. POINT(110 200) vs LINESTRING(110 200, 110 200)), causing an existing xmltest to fail.

Possible approaches

  1. Set the global isRelateNG flag and investigate/fix the EqualsTopo discrepancy for degenerate geometries.
  2. Have the geom package call RelateNG directly for Crosses (bypassing the global flag), though this means modifying the JTS transliteration layer.
Dominant language
Go
Stars
176
Forks
27
Avg merge
1d 14h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from peterstace/simplefeatures

All issues in peterstace/simplefeatures

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.