maproulette / maproulette/maproulette-backend
Store task `location` / `point` on LineString geometry (not only geometric center)
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 53
- Forks
- 39
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 12
Description
What would you like to see?
Summary
For tasks whose geometry is a LineString / MultiLineString, MapRoulette’s stored location (API point from /tasks/box) is often a geometric center that does not lie on the line. On curved ways the marker sits beside the road.
maproulette3 already works around this in the frontend by snapping markers to the nearest point on the line (PR maproulette/maproulette3#1041 — nearestPointToCenter() via @turf/nearest-point-on-line in AsMappableTask). Other clients (e.g. iD, Rapid) that place pins from task.point alone still show off-line markers.
Why is this useful?
Ask
Please compute and persist a display location that lies on the line geometry in the backend (or when tasks are created/updated), so tasks.location / API point is correct for all consumers—not only maproulette3’s map UI.
Suggested approach (same idea as the frontend):
- Take the current center / centroid of the task geometries
- Project it onto the line(s) with something like PostGIS
ST_ClosestPoint(or equivalent) - Store that as
location
Why backend?
- One fix for every editor/API consumer
- Avoids requiring
includeGeometries/ per-client Turf logic just to place a pin - Matches what maproulette3 already does for display https://github.com/maproulette/maproulette3/pull/1041
Edge cases to decide
- Mixed FeatureCollections (Point + LineString): which geometry to snap to?
- Multi-feature / MultiLineString tasks
- Migration / rebuild for existing tasks
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace task creation and update paths in the Scala backend to find where task geometries and the persisted location/API point are calculated. Review the proposed PostGIS closest-point approach, then define behavior for LineString, MultiLineString, mixed features, and existing-task migration; done means stored points lie on the relevant line geometry for all consumers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, scala
- Domain
- api, backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100