maproulette / maproulette/maproulette-backend

Store task `location` / `point` on LineString geometry (not only geometric center)

Open
#1,258 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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#1041nearestPointToCenter() 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):

  1. Take the current center / centroid of the task geometries
  2. Project it onto the line(s) with something like PostGIS ST_ClosestPoint (or equivalent)
  3. Store that as location
Why backend?
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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.