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

Update to Mapillary V4 API #113

Merged
merged 3 commits into from
Oct 14, 2022
Merged

Update to Mapillary V4 API #113

merged 3 commits into from
Oct 14, 2022

Conversation

kudlav
Copy link
Contributor

@kudlav kudlav commented Sep 28, 2022

I should point to the selected place but it's not reliable. Currently sometimes points to it, but sometimes it shows the opposite direction.

should fix: #97

@vercel
Copy link

vercel bot commented Sep 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
osmapp ✅ Ready (Inspect) Visit Preview Oct 14, 2022 at 8:18PM (UTC)

@zbycz
Copy link
Owner

zbycz commented Sep 28, 2022

Wow, good job @kudlav! I will review it tomorrow :)

@kudlav
Copy link
Contributor Author

kudlav commented Sep 29, 2022

Better than nothing, but the bearing function doesn't work properly. I've tried the best, tried different functions, but no success :(

const bearing = (a1: number, a2: number, b1: number, b2: number): number => {
const rad2deg = 57.2957795130823209;
if (a1 === b1 && a2 === b2) return Infinity;
let theta = Math.atan2(b1 - a1, a2 - b2);
if (theta < 0) theta += Math.PI * 2;
return rad2deg * theta;
};

The steps are:

  • get an images near the location
  • get the image that has the smallest deviation between picture compass angle and ideal angle of line from picture to the location

@zbycz
Copy link
Owner

zbycz commented Oct 1, 2022

So, I have managed to write some tests for the bearing function, and everything appears to be corect. I will continue with debuging the main function :)

@zbycz
Copy link
Owner

zbycz commented Oct 7, 2022

Hi @kudlav, so i think I have managed to fix the issue. There was only one issue, that you had Math.atan2(b1 - a1, a2 - b2) but it supposed to be Math.atan2(b1 - a1, b2 - a2). I wrote some unit tests to uncover this, but got confused what is right and wrong, so it took a little longer 😃

Also I refactored the code a little, so i could understand it more easily.

Right now, i left debugging output in place, because it helps understand which photo is chosen. The rotation of the marker is the compas_angle. Red marker is the closest one. Let me know if you found it working and we can remove this and merge it 🎉

eg.

Untitled

@zbycz
Copy link
Owner

zbycz commented Oct 8, 2022

Hmm, strange. I have found few examples, where Mapillary returns photos which are out of requested BBOX.

Eg.

I would like to know your point of view. Should we fill a bug report? Or maybe i am overlooking sth?

//edit: i tried replacing , with %2C as in here, and still wrong
//edit2: When i checked the real coverage of this area, the returned photos doesnt seem that wrong - a.k.a. there isnt any good photo anyway.

@zbycz
Copy link
Owner

zbycz commented Oct 14, 2022

So after a week i decided to merge this, we can update the algorithm if we found why is the Mapillary glitch happening. I would like your opinion on that.

I thought it would be good to have the debug info in place, so it can be switched on by adding debug_mapillary=true to localStorage.

Thanks for the great work! 👍 👍 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mapillary images are missing
2 participants