openlayers / openlayers/openlayers

Snap interaction not working correctly with Circles in GeometryCollection

Open
#17,095 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug pull request accepted
Dominant language
JavaScript
Stars
12.6k
Forks
3.2k
Avg merge
2d 17h
Merged PRs (30d)
21

Description

Describe the bug
These getType calls will return 'GeometryCollection', but the actual Geometry type is needed.

https://github.com/openlayers/openlayers/blob/1d25288271b15b6350cf0d22d9f621d85d0a1342/src/ol/interaction/Snap.js#L815-L815
https://github.com/openlayers/openlayers/blob/1d25288271b15b6350cf0d22d9f621d85d0a1342/src/ol/interaction/Snap.js#L838-L838
https://github.com/openlayers/openlayers/blob/1d25288271b15b6350cf0d22d9f621d85d0a1342/src/ol/interaction/Snap.js#L864-L864

Also with custom segmenters we can't assume the geometry type for the segments will match the geometries.

Should the segmenters return an object with the segments and geometry type? (would be a breaking change). Or allow both and wrap it in an object together with the type if an array is returned.

Contributor guide

Open the 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.

Research direction

Start in src/ol/interaction/Snap.js at the three cited getType calls around lines 815, 838, and 864, then trace how built-in and custom segmenters provide geometry information. Done means snapping handles circles inside GeometryCollection correctly and custom segmenters do not rely on an assumed geometry type, with the API impact of the proposed alternatives resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.