maproulette-backend icon indicating copy to clipboard operation
maproulette-backend copied to clipboard

Feature request: add BBOX-parameter to `/challenge/view` API endpoint

Open pietervdvn opened this issue 2 years ago • 5 comments

Hi,

I'm trying to setup an import flow (for openbenches.org) which uses mapcomplete as frontend and maproulette as backend. The challenge is here and contains about 27.000 items.

I want to load those points into MapComplete (see example below). MapComplete can load (tiled) geojson, for example as provided by tasks/box/{left}/{bottom}/{right}/{top} - but this one does not show tasks from private challenges (necessary for testing) and contains data that I don't need.

Alternatively, I can use /challenge/view/{id} from the API, which returns all tasks for the given challenge. This will return many tasks far away from the mapper, takes several seconds to download and, most importantly, chokes mapcomplete.

Ideally, this API call would include an extra parameter which allows to set a BBOX (or a slippy-map-tile z/x/y param) which would then return only tasks within that bbox (e.g. /challenge/view/{id}?bbox={left},{right},{top},{bottom})

Context

For context: a similar 'import'-flow has been prototyped but not used at scale (about 20 points). This is how it looks like image

The idea is that the contributor should not be aware of the tags that they edit. The 'import' button will prepare the correct tags and add a new point with these tags. Additionally, if a nearby feature matches, the contributor will be able to apply extra tags on the already existing feature. I've done a similar 'guided import' in the past, but using map notes as data storage.

(One can also browse all MapRoulette tasks here)

pietervdvn avatar Apr 18 '23 20:04 pietervdvn

@bhousel how does Rapid handle loading the private vs. public challenges (for a bbox)?

tordans avatar May 24 '24 12:05 tordans

Thanks for flagging this again @pietervdvn Team - let's discuss if we can do something here. I think this would be useful not just for MapComplete.

mvexel avatar May 24 '24 14:05 mvexel

@bhousel how does Rapid handle loading the private vs. public challenges (for a bbox)?

IIRC it works like this: We fetch Tasks with the /tasks/box endpoint, as that's the only one that supports tiled bbox queries. We check the results of that, and mark the tasks as private (hidden) if we haven't looked up the challenge details yet. We add new challenge ids we haven't seen before to a queue.

Then we fetch the missing Challenge details with challenge/{id}.
We check the results of that and use it to update the tasks' visibility, and also save whatever details live with the Challenge (like the changeset comment, sources, etc.)

bhousel avatar May 24 '24 16:05 bhousel

Thanks Bryan! And given that https://github.com/facebook/Rapid/pull/1446 works without additional queries that means that "but this one does not show tasks from private challenges (necessary for testing)" should be wrong or outdated @pietervdvn - right?

tordans avatar May 25 '24 12:05 tordans

but this one does not show tasks from private challenges (necessary for testing)" should be wrong or outdated @pietervdvn - right?

Bryan wrote:

mark the tasks as private (hidden)

I think that Bryan means "not shown in iD" with the word "private", not the private tasks on MapRoulette.

In either case, it feels a bit wasteful to download 100s of unnecessary tasks.

pietervdvn avatar Jun 20 '24 16:06 pietervdvn