mapillary / mapillary-python-sdk

A Python 3 library built on the Mapillary API v4 to facilitate retrieving and working with Mapillary data.
MIT License
39 stars 15 forks source link

[Requirements] 7. Get All Images In A BBox #18

Closed Rubix982 closed 3 years ago

Rubix982 commented 3 years ago

Is your feature request related to a problem? Please describe. This issue deals with the 7th requirement from the PRD of getting a complete list of all images within a BBox

Describe the solution you'd like The base requirements are,

  1. Take BBox coordinates as an argument
  2. Filter argument: date, pano/flat, maybe more

Describe alternatives you've considered NA

Additional context Output is a GeoJSON object. Could do the same for sequences and leave as an option to return either image (point) or sequences (line). Sequences would NOT be cut at BBox boundary, would select all sequences which are partially or entirely in BBox

Rubix982 commented 3 years ago

@cbeddow clarification needed for the filters, specifically, what does "maybe more" include?

cbeddow commented 3 years ago

So for the bbox, the main filters that are possible are basd on image attributes:

1) date 2) pano true/false (aka pano, flat, or all) 3) compass_angle 4) id (of the image) 5) sequence_id 6) organization_id

I think we should consider then the filers being

1) date 2) image_type = pano/flat/all 3) compass angle (<, <=, ==, >=, > as operators, 0 to 360 value) 4) sequence_id (nice way to just get all the images if you already know a sequence ID. Can test with this ID: qo14his8wis2zr9b5ibkty and this one 5joogqoraxm4ivy9nov8um both in Cairo near lon,lat of 31.344965040154193,30.06790995332507) -- this can accept a list of sequence IDs or a single 5) organization_id -- this can accept a list of organization IDs or a single, can test with this one near lon,lat of 9.234255434653846,45.49272380674151, key: 299471381648571

OmarMuhammedAli commented 3 years ago

Could do the same for sequences and leave as an option to return either image (point) or sequences (line). Sequences would NOT be cut at BBox boundary, would select all sequences which are partially or entirely in BBox

@cbeddow Can you elaborate on this bit?

cbeddow commented 3 years ago

@OmarMuhammedAli if you see here on the map, you have lines connecting the images points, the lines are called sequences: https://www.mapillary.com/app/?lat=38.12632432395972&lng=13.352981535432832&z=15.663870096511362

Some users may want to just download the sequences (lines), instead of downloading the images (points).

If a user wants to download the lines, they will need to download from the tile endpoint with the layer as sequence instead of image when decoding with vt2geojson library.

So maybe we make a separate function for getting the lines, or we make it an option in this function.

For the part about cutting the sequences at bbox boundary, it might be that the request to the tile returns lines which sometimes extend beyond the bounding box (because part of the line originates inside the tile). We could exclude parts of the line geometry which are outside the bounding box, but I believe we should not do this for no. So this means just no action to be taken after retrieving the data from the tile, though in the future it may be worth considering an option to exclude any part of the geometry which is outside the bbox and keep the parts inside, meaning splitting a complete line.

Let me know if you need to take a deeper look on this part!