Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KartaView photos seems broken #1509

Closed
bhousel opened this issue Aug 7, 2024 · 0 comments
Closed

KartaView photos seems broken #1509

bhousel opened this issue Aug 7, 2024 · 0 comments
Assignees
Labels
bug-regression It worked before but now it doesn't feature-streetview Issue or request related to the streetview viewer
Milestone

Comments

@bhousel
Copy link
Contributor

bhousel commented Aug 7, 2024

When enabling the KartaView photo layer, the requests fail with 400 Bad Request.

Screenshot 2024-08-07 at 12 31 50 PM

Looks like it is related to these lines:

_loadNextTilePage(currZoom, tile) {
const bbox = tile.wgs84Extent.bbox();
const maxPages = this._maxPageAtZoom(currZoom);
const nextPage = this._cache.nextPage.get(tile.id) ?? 1;

...because currZoom can be float and _maxPageAtZoom expects integers.
This means maxPages will end up 'false',
Then the (nextPage > maxPages) comparison will fail,
Then we'll try fetching page Infinity, triggering the bad request.

@bhousel bhousel self-assigned this Aug 7, 2024
@bhousel bhousel added the bug-regression It worked before but now it doesn't label Aug 7, 2024
bhousel added a commit that referenced this issue Aug 9, 2024
(closes #1509)

There's a bunch of cleanup in here.

The main issues with KartaView were:
- The `_maxPageAtZoom` function was being passed float zooms not integer
  zooms, so it was failing and the code was attempting to fetch page `Infinity`
- The old `https://api.openstreetcam.org/2.0/photo/` API was being called with
  a `sequenceId=` param to fetch all the urls for all photos on sequence.  This was
  unnecessary (we only need the URL we are about to show) so I changed it to
  just get a single photo.  (doing it the other way was actually returning
  paginated results, so we'd only ever show the first 99 photos in a sequence)
- `selectImageAsync` and promises means that we can eliminate the `waitingForImage`
  variable that wasn't actually being used correctly anyway.
- I fixed active styling the KartaView images too.
- Also added `isPano` in a few places to prepare for 360deg Kartaview images.
- probably other things
@bhousel bhousel added the feature-streetview Issue or request related to the streetview viewer label Aug 9, 2024
@bhousel bhousel added this to the v2.4 milestone Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-regression It worked before but now it doesn't feature-streetview Issue or request related to the streetview viewer
Projects
None yet
Development

No branches or pull requests

1 participant